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 #2162

Closed JiuRanYa closed 2 years ago

JiuRanYa commented 2 years ago

sendbox: https://codesandbox.io/s/xenodochial-engelbart-w9ehy0?file=/src/main.ts

  1. Now:

if you use createstore like vuex'doc in ts file, you can't get the correct type like this:

image

I checked the createstore's ts interface, it's an object:

image

so you need to write code like this in order to get the correct type:

image

  1. expected: when you use the way of vuex's docs in ts, get the correct ts type;

  2. How to solve the problem:

    • modify the vuex's docs
    • find some way to support the first way and get the correct ts type

I'd like to handle this issue

vue-bot commented 2 years ago

Hello, thank you for taking time filling this issue!

However, we kindly ask you to use our Issue Helper when creating new issues, in order to ensure every issue provides the necessary information for us to investigate. This explains why your issue has been automatically closed by me (your robot friend!).

I hope to see your helper-created issue very soon!