From 5faec885f38397393fab5ae62e25cd77e92ac437 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90?= Date: Sun, 26 Sep 2021 00:06:46 +0800 Subject: [PATCH] feat(dev): add global component types for volar (#3624) * feat(dev): add global component types for volar * chore: update README.md --- README.md | 2 ++ docs/en-US/guide/quickstart.md | 14 ++++++++++++++ .../element-plus/global.d.ts | 0 3 files changed, 16 insertions(+) rename typings/components.d.ts => packages/element-plus/global.d.ts (100%) diff --git a/README.md b/README.md index 0a8a0ce87016a..2e882fa9b18f0 100644 --- a/README.md +++ b/README.md @@ -137,6 +137,8 @@ $ pnpm gen component-name Note the `component-name` must be in `kebab-case`, combining words by replacing each space with a dash. +And component type must be added to `packages/element-plus/global.d.ts`. + ## Commit template With command diff --git a/docs/en-US/guide/quickstart.md b/docs/en-US/guide/quickstart.md index 095537ae80e75..7ec3af60049d1 100644 --- a/docs/en-US/guide/quickstart.md +++ b/docs/en-US/guide/quickstart.md @@ -25,6 +25,20 @@ app.use(ElementPlus) app.mount('#app') ``` +#### Volar support + +If you use volar, please add the global component type definition to `compilerOptions.types` in `tsconfig.json`. + +```json +// tsconfig.json +{ + "compilerOptions": { + // ... + "types": ["element-plus/global"] + } +} +``` + ### On-demand Import You need to use an additional plugin to import components you used. diff --git a/typings/components.d.ts b/packages/element-plus/global.d.ts similarity index 100% rename from typings/components.d.ts rename to packages/element-plus/global.d.ts