-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
experimental typesafety phase 2 #12022
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
so that we can reuse this for typescript plugin
a9a8aae
to
f9325ab
Compare
f9325ab
to
f20414d
Compare
f20414d
to
2d5e406
Compare
|
||
For other APIs you don't own — like third party libraries — you expect types to be provided for you. | ||
That way, you can stick to annotating your own APIs when necessary but let type inference do the heavy lifting everywhere else. | ||
So it feels unnatural to do so for React Router's route export API. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sentence is a little awkward, maybe something like
So it feels unnatural to do so for React Router's route export API. | |
That's why it feels unnatural to annotate React Router's route export API. |
Remix and React Router already use Vite to compile and bundle your code. | ||
So delegating typechecking to TypeScript programmatically is less of a departure from `tsc` than using Vite is. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should just be 1 sentence
Remix and React Router already use Vite to compile and bundle your code. | |
So delegating typechecking to TypeScript programmatically is less of a departure from `tsc` than using Vite is. | |
Remix and React Router already use Vite to compile and bundle your code, so delegating typechecking to TypeScript programmatically is less of a departure from `tsc` than using Vite is. |
One reason you might want to do this is if your project uses tools that independently inspect types in your app. | ||
For example, [typescript-eslint](https://typescript-eslint.io/) will think that route export args are typed as `any`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know the implications of this exactly, but my understanding is this is a very popular package, so I'm a bit nervous about this disclaimer. Not sure if there are patterns or an eslint plugin or something we can provide to help smooth adoption, but as it's written this basically sounds likes
if you want to use
typescript-eslint
you don't get automatic typing at all, you have to manually type everything
Is that correct?
closing as we think we have a better, simpler approach that doesn't require injecting types for route modules and has better interop with other tools. still fun to see how far this experiment could push things! |
Depends on #12019
nothing to see here, move along
TODO