Open strokirk opened 1 week ago
It's not really what's causing the issue but the target
option in tsconfig.json
is supposed to be a number, not a string.
It looks like you need to set "strict": true
in tsconfig.json
to fix it.
I seem to recall there was some related non-strict issue but if it's only in 2.7 Vue types then I'm not sure if there is any chance of it being fixed.
@rchl Thanks for the guidance, I figured something like that would be the case for Vue2.
Interestingly, adding "strict": true
doesn't help in my production repo - methods are still missing, but I'm having a harder time making a proper minimal reproduction.
Vue - Official extension or vue-tsc version
2.1.10
VSCode version
1.95.1
Vue version
2.7.16
TypeScript version
5.6.3
System Info
package.json dependencies
Steps to reproduce
Using
vue-tsc
on a Vue 2 component using the options API, the componentmethods
are not included as part of the instance type ifprops
is also present in the same component. For example:What is expected?
No error should be shown.
What is actually happening?
Link to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-bxhnjs?file=src%2Fcomponents%2FHelloWorld.vue
Any additional comments?
Workaround: Following the comment in https://github.com/vuejs/language-tools/issues/1850#issuecomment-1281618777, manually setting
vueCompilerOptions.optionsWrapper
seem to help:However, as a drawback, you then get a Doctor warning: https://github.com/vuejs/language-tools/blob/master/extensions/vscode/src/features/doctor.ts#L120