victorgarciaesgi / nuxt-typed-router

🚦Provide autocompletion and typecheck to Nuxt router
https://nuxt-typed-router.vercel.app
MIT License
361 stars 12 forks source link

Parameter type generated wrongfully when using a directory containing a parameter #118

Closed just-maik closed 1 year ago

just-maik commented 1 year ago

Describe the bug When using a directory containing a parameter and another parameter on a deeper level (as shown in the screenshot) typed router generates:

<{
     lang: string[]
}>

ignoring the second parameter

Expected behavior

<{
     lang: string
     slug: string
}>

Screenshots image image

Environnement infos

Your pages folder structure

pages ├── [lang] │ ├── index.vue │ ├── posts │ │ └── [slug].vue │ ├── products │ │ ├── [slug].vue │ │ └── index.vue │ └── reseller.vue └── index.vue

victorgarciaesgi commented 1 year ago

Hello! Can't reproduce on my side, can you make a reproduction here please? https://stackblitz.com/edit/github-7e4xvw?file=package.json,store%2FtestRouter.ts

just-maik commented 1 year ago

https://stackblitz.com/edit/github-7e4xvw-wtn1i3?file=pages%2F%5Blanguage%5D%2Fuser%2F%5Bid%5D%2Fposts.vue

I hope this works, otherwise I can provide a reproduction repo

victorgarciaesgi commented 1 year ago

@just-maik In your repro I have the correct types :/

image

The intellisense doesn't work so test on the .ts file :)

victorgarciaesgi commented 1 year ago

There's maybe a module that interfere with it, do you use i18n?

victorgarciaesgi commented 1 year ago

Just saw nuxt-typed-router@2.3.5, install the latest version 3.3.1

just-maik commented 1 year ago

Well that fixed my issue... I was so sure I manually updated to the latest version, but my package.json kept 2.3.5 😄

Thanks for the fast response!