Issue
Issue:
Property 'projects' does not exist on type 'CreateComponentPublicInstance<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, EmitsOptions, {}, {}, false, OptionTypesType<{}, ... 4 more ..., {}>, ... 5 more ..., {}>'
For some reason it's screaming on computed, You can see my this.project or this.message.
I have no idea how to fix it, please help. package.json
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.18.0",
"@typescript-eslint/parser": "^4.18.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-plugin-typescript": "~4.5.0",
"@vue/cli-plugin-vuex": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/compiler-sfc": "^3.0.0",
"@vue/eslint-config-prettier": "^6.0.0",
"@vue/eslint-config-typescript": "^7.0.0",
"eslint": "^6.7.2",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-vue": "^7.0.0",
"cross-env": "^7.0.3",
"css-loader": "^5.2.6",
"fork-ts-checker-webpack-plugin": "^6.2.10",
"less": "^3.0.4",
"less-loader": "^5.0.0",
"sass-loader": "10.1.1",
"terser-webpack-plugin": "^4.2.3",
"prettier": "^2.2.1",
"typescript": "~4.1.5"
}
The issue is coming from when i add to shims-vue.d.ts:
import { ComponentCustomProperties } from 'vue'
import { Store } from 'vuex'
declare module '@vue/runtime-core' {
// declare your own store states
interface State {
count: number
}
// provide typings for `this.$store`
interface ComponentCustomProperties {
$store: Store<State>
}
}
Then it showing my error. If i remove the store declaration, it's screaming on the store but not on the computed.
Solution
I have added
import { ComponentCustomProperties } from "vue";
import { Store } from "vuex";
declare module "@vue/runtime-core" {
interface ComponentCustomProperties {
$store: Store<State>;
}
}
to vuex-shim.d.ts and the issue is resolved.
Answered By - Vadim T
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.