Closed pleek91 closed 2 weeks ago
Name | Link |
---|---|
Latest commit | 0e82a1562bc8d609c5c08a19ab17425b1c796547 |
Latest deploy log | https://app.netlify.com/sites/kitbag-router/deploys/6674dc741c88920008f6ade1 |
Deploy Preview | https://deploy-preview-199--kitbag-router.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
Description
The
isRoute
type guard was functionally sound and types work just fine. ButRouterRoute
produced a type that was too specific and to wide. So when passing aRouterRoute
intoisRoute
the types conflicted and effectively didn't narrow properly. A few changes were necessary to fix this.Route
type to default to astring
for the key rather thanany
. Becauseany & 'key'
is stillany
. Butstring & 'key'
is'key'
. Which is what we want.Omit
utility fromRouterRoute
declaration. This produces a much simpler type and one that typescript can reason about without evaluating it.DeepReadonly
types withReadonly
to produce simpler types that typescript can reason about more easily (and produce much more readable types)readonly
(to satisfy theDeepReadonly
removal)3 & 4 were not strictly necessary. I had a working version that still used the readonly types, but everything looks much better without it. I want to revisit this in a follow up PR. For now I've marked the one test that covered the readonly pieces as
fails
.