Zero effort type-safety #12139
Replies: 3 comments 3 replies
-
Disclaimer: This proposal here is a next step improvement. |
Beta Was this translation helpful? Give feedback.
-
I would also prefer this. Curious if the React Router team previously discussed this decision anywhere, so we can see? |
Beta Was this translation helpful? Give feedback.
-
They have reasons against that written up in decision doc - https://github.com/remix-run/react-router/blob/main/decisions/0012-type-inference.md#zero-effort-typesafety It was implemented this way at first and changed later on due to concerns listed in the decision doc |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
As of React Router v7,
React Router uses TypeScript virtual files to accomplish typed routes.
We have a generated file
+types.*
where we import types from.While it is better that it was before, it can be even better!
What if we strip the types and still have full type safety?
If you are interested in how to achieve that,
please take inspiration from https://svelte.dev/blog/zero-config-type-safety (Svelte took inspiration From Next)
Beta Was this translation helpful? Give feedback.
All reactions