victorgarciaesgi/nuxt-typed-router

Coerce typings to ignore particular route

avdwio opened this issue · 2 comments

avdwio commented

I have some paths in my application that are designed as either a) catch-all paths, or otherwise b) designed only to be accessed from an external link (think email verification). Is there a way to coerce nuxt-typed-router to NOT generate types for a given path?

Specifically, I have a file pages/[...slug.vue] which will redirect users who go to an incorrect route. This breaks all of my path types as now navigateTo etc. will take any string.

Another usecase is when we are ignoring paths in the application build, such as in

I'm suspecting we may not be able to do this after reading through this issue, OR ignored routes could be designated within nuxt.config.ts? Unsure, but keen to get some thoughts.

Hello, I see what you mean!
I think it would me cleaner to do it by configuration, i'll see what api work best for most cases, and without caveats.
Like having a

ignoreRoutes: ["[...slug].vue", "admin/[...404].vue"]

Do you think it would be right?

Released in 3.3.0, with the experimentalIgnoreRoutes option