Skip to content

Commit

Permalink
feat: 自动生成加载组件类型
Browse files Browse the repository at this point in the history
  • Loading branch information
yuntian001 committed Sep 22, 2022
1 parent ecaa1d9 commit 9d7f3d9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions template/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ declare module '@vue/runtime-core' {
//code
}
}
declare global {
//typeCode
}
export {};
4 changes: 4 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ export default ({ command, mode }: ConfigEnv): UserConfigExport => {
key: '//code',
template: '{{name}}: typeof import("{{path}}")["default"];\n ',
},
{
key: '//typeCode',
template: 'type {{name}}Instance = InstanceType<typeof import("{{path}}")["default"]>;\n ',
},
],
name: '_{{name}}',
},
Expand Down

0 comments on commit 9d7f3d9

Please sign in to comment.