-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Property 'xxx' does not exist on type 'ComponentPublicInstance' #2775
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 use arrow function while using validator or default attr. #2474 |
This answer is correct. |
I'm having the same problem, but with <script lang="ts">
export default {
data() {
return {
platform: "x86_64"
};
},
computed: {
showMachines() {
return this.platform === "arm" || this.platform === "aarch64"; // Error here, on platform
},
showAarch64() {
return this.platform === "aarch64"; // Here too, same place
}
}
};
</script> |
showMachines(): boolean { For more help, please use chat.vuejs.org |
The same problem with you. It's confused. |
@ravenclaw900 @bobohuochai as @LinusBorg point as soon you define the return types of your computed properties the types from the data properties will work just fine(looks like not doing it breaks all the typing on the component). |
thank you very much! |
This works. The problem of TypeScript |
I had this problem for objects that I was injecting into my component. For anyone having problems with typing injected data, the solution is to use the Composition API instead. |
thanks, also correct resolve my problem, ts error with data. |
Uh oh!
There was an error while loading. Please reload this page.
Version
"vue": "^3.0.0"
"eslint": "^6.7.2"
"typescript": "~3.9.3"
vue-cli@latest
Reproduction link
Steps to reproduce
What is expected?
No ts warning
What is actually happening?
ts warning show:
file name: BarCharts.tsx,
use vscode vetur@latest.
The text was updated successfully, but these errors were encountered: