-
-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(dev): check component types in playground.vue #16843
Conversation
You can probably enable dts in unplugin-vue-components instead of adding them all to GlobalComponents manually |
@@ -20,7 +20,7 @@ const components = files.filter(file => file.startsWith('src/labs') || !block.so | |||
const map = new Map(components.flatMap(file => { | |||
const src = readFileSync(file, { encoding: 'utf8' }) | |||
const matches = src.matchAll(/export const (V\w+)|export { (V\w+) }/gm) | |||
return Array.from(matches, m => [m[1] || m[2], file.replace('src/', '@/')]) | |||
return Array.from(matches, m => [m[1] || m[2], file.replace('src/', '@/').replace('.ts', '')]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To assist vue-tsc
work properly, have to remove .ts suffix for import paths, so unplugin-vue-components can yield
VBtn: typeof import('@/components/VBtn/index')['VBtn']
👍
as opposed to
VBtn: typeof import('@/components/VBtn/index.ts')['VBtn']
👎
TS 4.x does not support .ts suffix in import path, and it looks like to be one of tasks in TS 5.x roadmap
Issue: microsoft/TypeScript#37582
PR: microsoft/TypeScript#51669
More importantly, this change does not break yarn dev
packages/vuetify/dev/components.d.ts
Outdated
} | ||
} | ||
|
||
export {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just add this to gitignore, otherwise it'll change every time you modify the playground
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also eslintignore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also eslintignore
this file will be ignored by git so it doesn't bother lint command in CI. Assuming this is for IDE experience, then a .eslintignore
file should be placed in root directory
Description
A script command that can perform type check against
playground.vue
, steps:playground.vue
haslang="ts"
in script tagyarn dev
components.d.ts
yarn dev:typecheck
Markup:
The command will produce error from Markup: