Closed kwhitley closed 1 year ago
Happy to try and help with this- it looks like you're starting with just the vanilla types in your branch and that will be a WIP branch for a bit?
Yep, WIP until we can get this stuff sorted... conversely, I can ditch the lofty TS goals and do a short-term "release as-is" to simply get the non-typed extras into the core (as a start) with a fully typed version to follow...
Got it. I’ll look through the code and get my bearings.
@kwhitley I did some playing around with this and ran into issues with typing proxied "anything method" shorthands. The issue with it boils down to not being able to capture the actual method key as a string type dynamically. It could still be supported but I am curious how valuable you find that feature overall because it seems to add a lot of overhead for what you're getting from it.
An alternative would be to support something like:
router.add("method", Pattern | Regex, ...handlers)
We could still support the proxy of arbitrary methods through to that but the generic identity of the string type for the method literal would have to be not present. Again I think it would be wise to drop this feature.
Hey Matthew!
A few things:
itty-fetcher
, so there's light at the end of the tunnel for us! I'll be attempting to backport the bits over here shortly! :)
Folks, I'm in the middle of converting the entire library over to TS for the 3.0 release (which bring extras into the core lib for added convenience). That said, I'm a novice (at best) in TS, which can be difficult enough to type on a good day, much less with the ambiguous nature of:
With that said, I'm straight up struggling to convert the Router function itself to full TS, so I'm going to ask for help from you fine people. I'd love someone to help me rewrite a full
itty-router.ts
that:include-extras
branch... if someone nails this, I'd much prefer a direct PR so you get full contribution credit in the codebase, rather than just README credits (that I would obv include)!Thanks in advance for any help!
<3
Current WIP Branch