-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Vuex/Typescript mappers issue: property does not exist on type 'CombinedVueInstance<Vue, ...>' #1220
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
Me too! |
@JWong1105 vscode uses the typescript typings from the dependencies when using javascript |
how to fix it |
昨天VSCode大批量更新,去掉报错的办法,File->Proferences->Extensions->Vetur->Validation:Template , Cancel it. |
reload一下Vetur好了 |
reload the plugin |
Any update here? I've facing the same issue. |
We still face this issue, even with the latest version / release. |
We use mapGetters. |
I still face this issue using |
still face this problem with mapState, mapMutations etc. It can be reproduced if we have our component's computed/methods and vuex such as: computed: {
myProperty() {
return true
},
...mapState('someModule', ['someStateField'])
} |
@SanyaShevchuk Could you try annotating the other properties? (Computed methods require return value annotation). computed: {
myProperty(): boolean { // <- Here
return true
},
...mapState('someModule', ['someStateField'])
} |
The above fixed the issue for me. @kiaking thank you! |
yes I tried, it works for mapState and mapGetters, but does not for mapMutations. Ive added return type to methods as u did for computed, but still get an error |
@pablo-iwg did u have a case with mutations or only computed? |
I was using getters within a computed property and forgot to annotate the property. I was not using mutations. |
Ive added types for everything but method from mapMutations still gets me error
|
+1 |
I'm also only experiencing this with mapMutations, all getters and method return values are typed. |
Is there currently an open issue for this? I'm still seeing this for |
Just chiming in that I also get this issue, but only when computed: {
...mapState(['user']),
acquereurName(): string {
return this.item.acquereur?.formName ?? ''
},
}, Here I get But if my component only has this: computed: {
...mapState(['user']),
}, ...then there are no errors to report. |
Version
3.0.1
Reproduction link
https://github.com/mzymta/vuex-mappers-issue
Steps to reproduce
Add mapped methods using mapMutations, mapActions, create another component method that uses any of the mapped methods. Build fails with error:
The below code works fine if there is no methodThatUsesActionOrMutation() method.
With methodThatUsesActionOrMutation() method build fails with error:
What is expected?
mapped method pushStringArray() can be used in other component methods - build doesn't fail
What is actually happening?
Build fails with error:
TS2339: Property 'pushStringArray' does not exist on type 'CombinedVueInstance<Vue, {}, { methodThatUsesActionOrMutation(): void; }, { newStr: any; }, Reado...'.
The text was updated successfully, but these errors were encountered: