victorgarciaesgi/nuxt-typed-router

Parameter type generated wrongfully when using a directory containing a parameter

just-maik opened this issue · 6 comments

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

  • Operating System: Linux
  • Node Version: v18.18.0
  • Nuxt Version: 3.7.4
  • CLI Version: 3.9.0
  • Nitro Version: 2.6.3
  • Package Manager: yarn@1.22.19
  • Builder: -
  • User Config: devtools, telemetry, modules, runtimeConfig, graphql-client, security, app, typescript
  • Runtime Modules: @vueuse/nuxt@9.13.0, @nuxtjs/device@3.1.1, nuxt-security@0.10.2, nuxt-graphql-client@0.2.30, nuxt-typed-router@2.3.5, nuxt-icon@0.2.11, nuxt-simple-sitemap@2.7.0, @dargmuesli/nuxt-cookie-control@5.10.4, nuxt-vitest@0.8.7, @nuxtjs/tailwindcss@6.8.0
  • Build Modules: -

Your pages folder structure

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

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 In your repro I have the correct types :/
image

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

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

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

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!