T
TanStack15mo ago
plain-purple

Meta works on lazy routes despite TS screaming

Why does the Meta property work on the lazy route despite Typescript saying it doesn't exist? Are there any issues with using the Meta prop on the lazy route and ignoring the type error?
No description
4 Replies
correct-apricot
correct-apricot15mo ago
Its because the underlying implementation of createRoute, createFileRoute, createLazyRoute, and createLazyFileRoute are all based off of the base Route class. We restrict what you can do at the type-level, do you don't put yourself into a situation where you are trying to lazily load in the critical route configuration.
correct-apricot
correct-apricot15mo ago
Code Splitting | TanStack Router React Docs
Code splitting and lazy loading is a powerful technique for improving the bundle size and load performance of an application. Reduces the amount of code that needs to be loaded on initial page load
correct-apricot
correct-apricot15mo ago
That's why we've restricted the accepted properties on a type-level.
plain-purple
plain-purpleOP15mo ago
Oh okay, thanks!!

Did you find this page helpful?