T
TanStack2y ago
eastern-cyan

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
like-gold
like-gold2y 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.
like-gold
like-gold2y 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
like-gold
like-gold2y ago
That's why we've restricted the accepted properties on a type-level.
eastern-cyan
eastern-cyanOP2y ago
Oh okay, thanks!!

Did you find this page helpful?