Typescript issue with union types affecting RouteNamedMap
#397
-
I'm opening a discussion about a Typescript issue Limit of 25 members when using union of mapped type, this limitation poses a problem for projects with a large number of routes, making it difficult to leverage the type safety and autocompletion benefits provided by the plugin Problem:When defining a interface RouteNamedMap {
Home: RouteRecordInfo<'Home', '/'>;
// ... 25 other routes
}
const router = useRouter()
const myRouteName = 'Home' as keyof RouteNamedMap;
router.push({ name: myRouteName }); // Argument of type '{ name: keyof RouteNamedMap; }' is not assignable to parameter of type... With more than 25 routes in the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
This is weird, I haven’t faced this error with larger amount of routes. Is it maybe specific to the way the route name is declared in this example? |
Beta Was this translation helpful? Give feedback.
Use satisfies instead of : NavigatinItem