-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
False type safety with meta v2 #6210
Comments
@machour sorry for the duplicate! Didn't see that issue |
no worries, I didn't even see that it was already fixed 😅 |
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
What version of Remix are you using?
v1.15
Are all your remix dependencies & dev-dependencies using the same version?
Steps to Reproduce
Expected Behavior
When you do
V2_MetaFunction<typeof loader>
in the meta function thedata
object is typed asT | undefined
whereT
corresponds to thetypeof loader
which warns the developer that the data object might not be defined and allows the developer to assure that the application doesn't break instead of it going into the error boundary.Actual Behavior
When you do
V2_MetaFunction<typeof loader>
in the meta function thedata
object is typed asT
whereT
corresponds to the return type oftypeof loader
which gives you a false sense of security because if anything unexpected in the loader breaks the data object won't be available on the meta function so if you try callingdata.title
instead ofdata?.title
it won't go into the error boundary but it will crash the application insteadThe text was updated successfully, but these errors were encountered: