Skip to content

Commit

Permalink
feat: volar support (jd-solanki#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
productdevbook committed Nov 18, 2022
1 parent 1c83462 commit 64af63e
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/anu-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@
"./dist/style.css": "./dist/style.css"
},
"files": [
"dist"
"dist",
"volar.d.ts"
],
"types": "dist/types",
"types": "./dist/types",
"scripts": {
"dev": "nr gen-comp-meta && vite build --watch",
"gen-comp-meta": "na tsx ../../scripts/gen-component-meta.ts",
Expand Down Expand Up @@ -67,4 +68,4 @@
"@vueuse/core": "^8.7.5",
"vue-router": "4"
}
}
}
3 changes: 3 additions & 0 deletions packages/anu-vue/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
"paths": {
"@/*": [
"*"
],
"anu-vue": [
"./src"
]
}
},
Expand Down
24 changes: 24 additions & 0 deletions packages/anu-vue/volar.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
declare module 'vue' {
export interface GlobalComponents {
AAlert: typeof import('anu-vue')['AAlert']
AAvatar: typeof import('anu-vue')['AAvatar']
ABadge: typeof import('anu-vue')['ABadge']
ABaseInput: typeof import('anu-vue')['ABaseInput']
ABtn: typeof import('anu-vue')['ABtn']
ACard: typeof import('anu-vue')['ACard']
ACheckbox: typeof import('anu-vue')['ACheckbox']
AChip: typeof import('anu-vue')['AChip']
ADialog: typeof import('anu-vue')['ADialog']
ADrawer: typeof import('anu-vue')['ADrawer']
AInput: typeof import('anu-vue')['AInput']
AList: typeof import('anu-vue')['AList']
AMenu: typeof import('anu-vue')['AMenu']
ARadio: typeof import('anu-vue')['ARadio']
ASelect: typeof import('anu-vue')['ASelect']
ASwitch: typeof import('anu-vue')['ASwitch']
ATable: typeof import('anu-vue')['ATable']
ATextarea: typeof import('anu-vue')['ATextarea']
ATypography: typeof import('anu-vue')['ATypography']
}
}
export { }
14 changes: 14 additions & 0 deletions packages/documentation/docs/guide/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,20 @@

It's done! 馃コ


## Volar Support
If you are using Volar, you can specify global component types by configuring compilerOptions.types in tsconfig.json.

// tsconfig.json
```json
{
"compilerOptions": {
// ...
"types": ["anu-vue/volar"]
}
}
```

Now, Just refer to the component in your vue files:

```vue
Expand Down

0 comments on commit 64af63e

Please sign in to comment.