Data from Vuex mapState helper string array shows error "Element is not exported"
When using the Vuex mapState helper as described in the Vuex docs, Webstorm does not recognize the computed properties.
Example:
<template>
<div>
<pure-task-list :tasks="tasks" />
</div>
</template>
<script>
import PureTaskList from "./PureTaskList";
import { mapState } from "vuex";
export default {
name: "task-list",
components: {
PureTaskList
},
computed: {
...mapState(["tasks"])
}
};
</script>
In this line:
<pure-task-list :tasks="tasks" />
"tasks" is underlined and shows "Element is not exported" on hover.
Supplying an arrow function also fails:
...mapState({ tasks: state => state.tasks })
The only way I can get Webstorm to recognize the store data is to explicitly define the computed property:
tasks() {
return this.$store.state.tasks
}
Is there any way to avoid this redundancy?
Please sign in to leave a comment.
Please vote for https://youtrack.jetbrains.com/issue/WEB-40929 to be notified on any progress with it
Ah, even searched open issues and missed that somehow. Thanks!