COMMUNITY REQUEST: Full conversion of Router function to TS (as part of 3.0 release)
See original GitHub issueFolks, 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:
- Proxies (with unknown/infinite traps)
- Mutating Requests (that don’t really have to be a true Request), as you’d experience while being injected with middleware
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:
- Passes all the existing tests without modification (must preserve the original API)
- Remains true to the original concept of “itty”… as in, the code should compress to an absurdly tiny size, and the even in its uncompressed form should be as short/light as possible.
- Remains flexible/easy to type while being able to handle as many scenarios as possible. This part doesn’t always play nice with the rigidity that TS users seem to expect, but by design, this library was designed to be flexible, specifically avoiding rigid definitions/expectations that may limit its applications.
- While this will fall under a major (breaking) revision, it’s not critical that types remain identical to pre 3.0. More importantly, I’d like it to be typed in a way that requires (ideally) no/few imported types from the library… as in you can just use your own generics/Request, etc, and it’ll still work as intended.
- Please fork off of, and PR into the
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!
❤️
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Router.use() requires middleware function but got a Object ...
I ported the get , post , put , delete functions to new router file while refactoring, and forgot to edit the paths....
Read more >oak@v10.2.1 | Deno
This middleware framework is inspired by Koa and middleware router inspired by @koa/router. This README focuses on the mechanics of the oak APIs...
Read more >TypeScript: JavaScript With Syntax For Types.
TypeScript is JavaScript with syntax for types. TypeScript is a strongly typed programming language that builds on JavaScript, giving you better tooling at ......
Read more >React Router v6 Preview
The next major version of React Router, version 6, is just around the corner. We published the first alpha release back in January, ......
Read more >Cisco cBR Converged Broadband Routers DOCSIS Software ...
The hardware components that are introduced in a given Cisco IOS-XE Release are supported in all subsequent releases unless otherwise specified. Table 1....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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?
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! 😃