vuejs / vuex

🗃️ Centralized State Management for Vue.js.
https://vuex.vuejs.org
MIT License
28.42k stars 9.58k forks source link

createStroe can't get the correct type if use the way of vuex's docs #2163

Closed JiuRanYa closed 2 years ago

JiuRanYa commented 2 years ago

Version

4.0.2

Reproduction link

codesandbox.io

Steps to reproduce

just open the reproduction, you'll find that

What is expected?

If you use the way of vuex's docs in ts file, get the correct ts type;

What is actually happening?

use the way of vuex's docs in ts file, can't get the correct ts type


  1. modify the vuex's docs
  2. find some way to support the first way and get the correct ts type
kpturner commented 2 years ago

Does not look to me like you have created the store in the manner described in the docs here: https://vuex.vuejs.org/guide/typescript-support.html