Attempting to get route results in Argument is not assignable to parameter of type 'keyof RouteNamedMap | undefined' #556
Unanswered
SaucyJack
asked this question in
Questions and Help
Replies: 1 comment
-
The error gives you the answer, it expects a // typed-router.d.ts
export interface RouteNamedMap {
'/dashboard/administration/automated-reports/': RouteRecordInfo<'/dashboard/administration/automated-reports/', '/dashboard/administration/automated-reports', Record<never, never>, Record<never, never>>,
'/dashboard/administration/automated-reports/[id]': RouteRecordInfo<'/dashboard/administration/automated-reports/[id]', '/dashboard/administration/automated-reports/:id', { id: ParamValue<true> }, { id: ParamValue<false> }>,
'/dashboard/administration/users/': RouteRecordInfo<'/dashboard/administration/users/', '/dashboard/administration/users', Record<never, never>, Record<never, never>>,
'/dashboard/administration/users/[id]/': RouteRecordInfo<'/dashboard/administration/users/[id]/', '/dashboard/administration/users/:id', { id: ParamValue<true> }, { id: ParamValue<false> }>,
'/dashboard/reports/some-report': RouteRecordInfo<'/dashboard/reports/some-report', '/dashboard/reports/some-report', Record<never, never>, Record<never, never>>,
} The key you're looking for is |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Versions:
unplugin-vue-router version 0.10.7
MacOS Sequoia 15.1.1
IDE: VS Code 1.96.0
I have a Vue project (composition API) with a "pages" folder structure something like this (I've omitted some aspects that are irrelevant):
I've reproduced this in this repository: https://github.com/SaucyJack/reproduce-ts-unplugin-router-error
in both
automated-reports/[id].vue
andusers/[id]/index.vue
, TypeScript/eslint produce an error when I attempt to get the route using vue-router, in code that looks like this:The error is:
I've run into this before and posted this SO question: https://stackoverflow.com/q/78898738/27457. I have tried all of the solutions offered there, and none of them fix the problem.
The code runs correctly with Vite using
npm run dev
.It's also important to note that a friend was able to reproduce this only when he changed his Node version to 20.15.1. When he was using v18.18.2, the error did not appear.
Beta Was this translation helpful? Give feedback.
All reactions