there is a module augmentation (types/test.d.ts):
import Vue from 'vue'
declare module 'vue/types/vue' {
interface Vue {
$test: string
}
}
And include it as (tsconfig.json):
// ...
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue",
"tests/**/*.ts",
"tests/**/*.tsx",
"types/*.d.ts"
],
// ...
And then, it works fine in any .ts file:
But it just gets a compile error in .vue file
Could anyone help me?
Try to add types/*.d.ts to typeRoots in yout tsconfig
Like this:
"typeRoots": [
"src/types"
],
(Normally I use @types to store my .d.ts files)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With