_worker.ts in Pages

Is there a way to use typescript in _workers.js in the same way as functions where all that’s required is changing the file extension?

_worker.js is intended to not be touched by bundlers/etc so having Typescript would break that.

You can just have a _worker.ts file yourself and then use tsc or a bundler like esbuild to output _worker.js

1 Like