Skip to content

Commit 0fb5da3

Browse files
committed
fix: add automatic types for param parsers
1 parent a523122 commit 0fb5da3

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

packages/playground-file-based/src/routes.d.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ import type {
1818
// Custom route params parsers
1919
type Param_date = ReturnType<NonNullable<typeof import('./src/params/date.ts').parser['get']>>
2020

21-
declare module 'vue-router/auto-resolver' {
22-
export type ParamParserCustom = 'date'
21+
declare module 'vue-router' {
22+
interface TypesConfig {
23+
ParamParsers: 'date'
24+
}
2325
}
2426

2527
declare module 'vue-router/auto-routes' {

packages/router/src/unplugin/codegen/generateDTS.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ ${paramsTypesDeclaration}
5454
5555
`.trimStart()
5656
: ''
57-
}declare module 'vue-router/auto-resolver' {
58-
export type ParamParserCustom = ${customParamsType}
57+
}declare module 'vue-router' {
58+
interface TypesConfig {
59+
ParamParsers: ${customParamsType}
60+
}
5961
}
6062
6163
declare module '${routesModule}' {

0 commit comments

Comments
 (0)