I am working with Vue and Typescript in Visual Studio Code and the Vetur extension. The problem: when I update any code, intellisense won't recognise the changes when working in a .vue
file. In .ts
files, intellisense IS working!
I use this definition file so that typescript recognises the .vue
file extension:
declare module "*.vue" {
import Vue from "vue";
export default Vue;
}
Example
test.ts just changed
export default class Test {
// testFunction() {} // just removed this
dummyFunction() {} // added this
}
app.vue intellisense not working
In any .vue
file, intellisense keeps suggesting testFunction and doesn't recognise dummyFunction:
import Test from "./test"
export default class App extends Vue {
created() {
const t = new Test()
t.testFunction() // allowed - but it doesn't exist
t.dummyFunction() // not allowed - but it does exist
}
}
somefile.ts intellisense is working
In regular old .ts files, intellisense works.
import Test from "./test"
const t = new Test()
t.testFunction() // here it works - this is not allowed
t.dummyFunction() // here it works - this is allowed
If I close VS Code and reopen, then the new changes are updated. Is this a Vetur glitch? Do I need to alter my tsconfig or definition files?
.ts
files and intypes.d.ts
files! I posted an issue in Vetur's github but for some reason they marked it as solved... – Tega