Skip to content

Commit

Permalink
Add shime type in setup doc
Browse files Browse the repository at this point in the history
  • Loading branch information
yoyo930021 committed Dec 8, 2020
1 parent 9daa90b commit 5ee921e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions docs/guide/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,28 @@ import a from 'components/a.vue'
import b from 'components/b.vue'
```

## Typescript

You need to add a shim type file for import vue SFC in typescript file.
### Vue2
```typescript
// shims-vue.d.ts
declare module '*.vue' {
import Vue from 'vue'
export default Vue
}
```
### Vue3
```typescript
// shims-vue.d.ts
declare module '*.vue' {
import type { DefineComponent } from 'vue'
const component: DefineComponent<{}, {}, any>
export default component
}
```


## Advanced
If you use monorepo or VTI or not exist `package.json` and `tsconfig.json/jsconfig.json` at project root,
You can use `vetur.config.js` for advanced setting.
Expand Down

0 comments on commit 5ee921e

Please sign in to comment.