kwhitley / itty-router

A little router.
MIT License
1.71k stars 77 forks source link

fix: Make RouterHints non-optional #134

Closed jahands closed 1 year ago

jahands commented 1 year ago

Optionality here was an unintended side effect of moving to script-mode TypeScript. Unfortunately, TS doesn't handle Proxies very well and thinks that these are undefined (which is technically true until the proxy is called.) TypeScript will hopefully make typing proxies better in the future: https://github.com/microsoft/TypeScript/issues/20846

Based on the tests, there is no change on the external interface caused by the @ts-expect-error, and the routes no longer show as possibly undefined image