Skip to content

Commit

Permalink
fix(types): for auto import
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Sep 30, 2022
1 parent 80fd444 commit 49ffe81
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion playground/auto-imports.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
export {}
declare global {
const defineLoader: typeof import('vue-router/auto')['defineLoader']
const definePage: typeof import('vue-router/auto')['definePage']
const definePage: typeof import('unplugin-vue-router/runtime')['_definePage']
const useRoute: typeof import('vue-router/auto')['useRoute']
const useRouter: typeof import('vue-router/auto')['useRouter']
}
9 changes: 7 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ export const VueRouterExports: Array<string | [string, string]> = [
'useRoute',
'useRouter',
'defineLoader',
'definePage',
// NOTE: the typing seems broken locally, so instead we export it directly from unplugin-vue-router/runtime
// 'definePage',
]

/**
Expand All @@ -199,6 +200,10 @@ export const VueRouterExports: Array<string | [string, string]> = [
* }),
* ```
*/
export const VueRouterAutoImports = {
export const VueRouterAutoImports: Record<
string,
Array<string | [string, string]>
> = {
'vue-router/auto': VueRouterExports,
'unplugin-vue-router/runtime': [['_definePage', 'definePage']],
}

0 comments on commit 49ffe81

Please sign in to comment.