-
-
Notifications
You must be signed in to change notification settings - Fork 443
"this" keyword infers type "any" instead of vue instance #1850
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
You should update to |
I don't mean to be disrespectful, @colinblaise, but is this an official answer? Where is this mentioned in the Readme or the Marketplace page? The project I'm using this for is not a hobby project, but a production-deployed one. Simply put, I cannot update the Vue version on a whim. |
No offense taken, I am in no way associated with the Volar project so no it is not an official answer. On another note, I've seen issues start happening when the typescript version of VSCode differs from the version Volar is using. Also, typing Is type inference broke if you downgrade to use Typescript 4.8.2 (takeover)? |
I've tried with TS 4.8.2 and I've changed the lang attribute value and made no difference. Well, guess I'll have to use an older version of the extension until this is either fixed or we get to migrate the Vue version. |
This is {
"vueCompilerOptions": {
"optionsWrapper": [
"(await import('@vue/runtime-dom')).defineComponent(",
")"
]
}
} |
Uh oh!
There was an error while loading. Please reload this page.
Context
I am developing a project using Vue 2.6.14 version.
That being said, I have configured tsconfig's vueCompilerOptions.target to "2".
Lets say I create the following component:
Now, lets also suppose I add the "created" hook:
Problem
The issue arises when I type "this." in the created() hook - or any other method or computed function, for that matter - the "this" keyword is set to type "any", as opposed to the correct type which should be an extension of Vue with a string property "name".
So, type inferring is completely off. Now, I have no idea wether this is a general bug of the extension, or it is simply related to the use of the "export default" syntax, using Vue 2 syntax.
Environment
The text was updated successfully, but these errors were encountered: