Type 'RouteName_3' cannot be used to index type 'GetRoutesParams<Omit<PrependBasePath<ParseRoute<BasePath>["path"], ParseRoutes<Routes>>, keyof GetAreaRoutes<PrependBasePath<ParseRoute<BasePath>["path"], ParseRoutes<...>>>>>'.
Closed this issue · 5 comments
Bug summary
There's a type error in createRouter.d.ts
:
Type 'RouteName_3' cannot be used to index type 'GetRoutesParams<Omit<PrependBasePath<ParseRoute<BasePath>["path"], ParseRoutes<Routes>>, keyof GetAreaRoutes<PrependBasePath<ParseRoute<BasePath>["path"], ParseRoutes<...>>>>>'
This is shown in VSCode if tsconfig.json
contains skipLibCheck: false
.
Library version
1.3.2
Environment info
Typescript 4.9.5
Steps to reproduce
skipLibCheck: false
.
Reproducible sample code
`skipLibCheck: false`.
@1EDExg0ffyXfTEqdIUAYNZGnCeajIxMWd2vaQeP Could you provide more informations? (the createRouter
call, where the TS error is reported exactly).
The example app on this repository use skipLibCheck: false
and don't suffer from this issue.
Steps to reproduce
- Clone this repo
- execute
yarn install && yarn build
- open
dist/createRouter.d.ts
in VSCode4 - This error message appears in the "Poblem" tab
Does that help?
@1EDExg0ffyXfTEqdIUAYNZGnCeajIxMWd2vaQeP Which repo?
@1EDExg0ffyXfTEqdIUAYNZGnCeajIxMWd2vaQeP Ok, I though it happened when using createRouter
in a particular way. Didn't get your point correctly.
It's fixed it in v1.3.3. When generating type declarations, TS "flatten" the types for concision. And here, it failed (probably because of the complexity of this type). Extracting this part as a GetCreateURLFns
type function solve this issue.
Thanks for reporting this!