vetur: Getting Property 'x' does not exist on type .... .Vetur(2339)
Info
- Platform: Win
- Vetur version: 0.24.0
- VS Code version:1.44.0-insider
Problem
adding properties inside a component breaks the known data and computed props and says Property 'x' does not exist on type 'CombinedVueInstance<Vue, object, object, object, Record<never, any>>'.Vetur(2339)
this can be a potential issue on next release of vscode maybe ?
Reproducible Case
Use veturpack and newest vscode-insiders I can confirm it works properly with current stable release of vscode
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 23 (2 by maintainers)
There is a new setting called
vetur.validation.interpolation
in 0.27. Description:Setting “vetur.experimental.templateInterpolationService” to
false
solved this issue for me.Setting “vetur.validation.script” to false solved this issue for me.
Weird, this just started happening to me today. MacOS Catalina. Setting
vetur.experimental.templateInterpolationService
like @red-meadow suggested doesn’t work for me. It was disabled already, and toggling doesn’t seem to have any effect.I wonder what has changed where to cause this…
Having this issue as well,
vetur.experimental.templateInterpolationService
was disabled. Code works perfectly fine, but the code minimap gets lit up like a Christmas tree. At least it’s in season I guess.props
set prop type as
PropType<T>
and return default value asT
computed
explicit declaration the return value type
You can’t disable validation and still have intellisense. Those go together.
Enable validation and fix type issues instead. How? It depends on your code but typically you have to add type annotations in various places.
Also see https://github.com/vuejs/vetur/blob/master/docs/guide/FAQ.md#property-xxx-does-not-exist-on-type-combinedvueinstance
If you are having computed properties, you would need to annotate them (with JSDocs): https://vuejs.org/v2/guide/typescript.html#Annotating-Return-Types
Otherwise TypeScript is unable to infer
this
type. Even though you are writing JS, Vetur is using TS to support it.Unchecking Vetur > Validation: Interpolation resolved the issue for me.
disable vetur.validation.interpolation . Waring is not show, but hint is not work 😞
I had the following error threw by Vetur.
Following what @octref said:
I just gave the method a return type and the error went away.
Types is not a runtime thing. What you see at runtime is not gonna match types if you don’t have types set up properly.
That’s not a problem related to Vetur. Please ask for help in Nuxt discord, for example (https://discord.com/invite/ps2h6QT).
Change to false “vetur.validation.script” solved for me. Thanks.