标签: typescript vuex eslint typescript-eslint
对于下面显示的代码,我收到以下 lint 错误。 如何解决? 任何值上的不安全成员访问 .item.eslint@typescript-eslint/no-unsafe-member-access
答案 0 :(得分:2)
这个错误意味着 store.state 是任意的。确保它具有正确的类型。
store.state
答案 1 :(得分:0)
感谢 Logan Devine 和 Jesper 的帮助。
状态类型为 StateInterface。
我通过如下转换状态类型解决了这个问题。希望这个修复是正确的。
const itemName = computed(() => (<StateInterface> store.state).item.itemName)