我正在尝试使用 Vue3 和 typescript 初始化一个项目,但是将 vuex 添加到项目后,它不会\xc2\xb4t 编译。
\n我做了什么:
\nnpm install vuex@next --save\nRun Code Online (Sandbox Code Playgroud)\n因此,在我的简单存储文件中,我有:
\nimport { type InjectionKey } from \'vue\'\nimport { createStore, Store } from \'vuex\'\n\n// define your typings for the store state\nexport interface State {\n count: number\n}\n\n// define injection key\nexport const key: InjectionKey<Store<State>> = Symbol()\n\nexport const store = createStore<State>({\n state: {\n count: 0\n }\n})\n …Run Code Online (Sandbox Code Playgroud)