You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to have a zod discriminated union I cannot achieve full type safety. See the example app (__root.tsx and about.tsx). Basically I tried 3 approaches. Setting the undesired parameters to undefined, never and omitting them. Each of these approaches causes a different error:
If I use z.never type issues occur at About 2 link
If I use z.undefined type issues in the search middleware in the about route
If I omit them and not have them at all the loader cannot be typed.
Which project does this relate to?
Router
Describe the bug
When trying to have a zod discriminated union I cannot achieve full type safety. See the example app (__root.tsx and about.tsx). Basically I tried 3 approaches. Setting the undesired parameters to undefined, never and omitting them. Each of these approaches causes a different error:
Your Example Website or App
https://stackblitz.com/edit/tanstack-router-qm8eay?file=src%2Froutes%2F__root.tsx,src%2Froutes%2Fabout.tsx&preset=node
Steps to Reproduce the Bug or Issue
See the about.tsx component and its search params.
See the about.tsx component and the links inside.
Expected behavior
I expect to have a proper discriminated union type.
Screenshots or Videos
No response
Platform
Additional context
No response
The text was updated successfully, but these errors were encountered: