Closed kwhitley closed 2 years ago
Would it be an option to just convert the project to a Typescript project? Then I'm thinking that it would be pretty easy to export both esmodules and cjs.. If it's of interest I could whip together a PR for this?
You can certainly try @markusahlstrand! While I'm happy for typings to go alongside itty, i'm far less concerned that itty itself is typed for a few reasons:
Request
, as we want anything that somewhat looks like a Request
to pass. All we care about is a method and a url. The rest, including any additional params, is completely up to the user (or downstream abstraction authors) to tailor to their needs.On the flipside, a much better candidate for a full TS conversion is itty-router-extras
!
Pending release via #98
Hey all! To help with a few issues people have found regarding import into different scenarios (Deno, Jest, etc), I'm proposing a hybrid module export from the build process:
export const Router = ...
)Further investigation into this (and what the underlying issue is) would also be helpful, as I have used itty using esbuild (Cloudflare ES module syntax), as well as traditional CommonJS into webpack builds (or even just using
require
without w bundler for things like itty's own Jest tests). It always seems to work for me, so I'm not sure what the issue is!I'll be out of the country (without my computer) for the next few weeks, so any help before I return mid-January would be greatly appreciated!
Cheers and Happy Holidays!