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
When using shorthand function initializer on computed
, this.foo
shows error
#1175
Comments
You need to setup path mapping: https://github.com/vuejs/vetur/blob/master/docs/FAQ.md#vetur-cant-recognize-components-imported-using-webpacks-alias. |
That’s fine but I don’t think that will help the issue with not recognizing the variables defined in the data() section, nor the getters defined my the mapGetters/mapState |
Can you post a minimal reproducible example. Like the source of a full SFC. |
By "minimal reproducible example" I meant put your project generated with vue-cli in a public GH repo. |
Here you go. https://github.com/jtsom/VeturTest See the lines marked // NOT RECOGNIZED |
computed
, this.foo
shows error
I’m not seeing how you changed the way computed was written? |
And why wouldn’t “cardData” work? How would I make it work (not give an error)? Short of ignoring the error... |
Sorry that's overlapped behind the hover. Try As for |
Modules and namespaces: https://vuex.vuejs.org/guide/modules.html#binding-helpers-with-namespace |
I can confirm that writing computed functions with explicit Working with TS. |
Not sure if it helps, but the computed block parses correctly as long as any entry uses the |
Upstream issue: See this comment. For now you can try to annotate the return type with JSDocs: |
@denis-pujdak-adm-it |
@denis-pujdak-adm-it Patcher56 is correct, you need to use export default Vue.extend({
data() {
// etc.
}
}); |
Should be fixed as we upgraded to TS 3.6.3 in Vetur 0.22.3. |
Info
Problem
In a Vue application that is using just plain Javascript (<script>), setting
in
jsconfig.json
to enable the new features mentioned in 0.18.0 ( "compilerOptions": {"checkJs": true
})
causes many things that were errors to show up as errors.
Variables defined in a data() section are not recognized:
Reproducible Case
Create a new vue (cli) app, add some variables in a data statement, see the errors.
Try adding an import with a @.
The text was updated successfully, but these errors were encountered: