Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core/types): add chaining derivation support to mapState & mapGetters #674

Merged
merged 11 commits into from
Jan 13, 2021

Conversation

anotherso1a
Copy link
Collaborator

fix $forceUpdate's types

add chaining derivation support to mapState & mapGetters
@anotherso1a anotherso1a requested a review from hiyuki December 11, 2020 07:12
@anotherso1a
Copy link
Collaborator Author

新修复了一些问题,当使用createStoreWithThis创建store时,如果引入createStore创建的store会报错。此时采用老版本兼容方式处理。

@anotherso1a anotherso1a requested a review from hiyuki December 24, 2020 05:48
Comment on lines 241 to 242
dispatch(type: string, ...payload: any[]): any
commit(type: string, ...payload: any[]): any
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里这样写主要是因为使用dispatch: () => {}这种形式定义的方法在ts中无法在同一个对象里面进行重载。

报错: Duplicate identifier 'dispatch'.ts(2300)

如果想要重载现在看来只能采取这种迂回的方式。

@anotherso1a
Copy link
Collaborator Author

优化了一下写法,后续如果统一使用createStoreWithThis之后可以直接出除去用于重载的interface

@anotherso1a
Copy link
Collaborator Author

关闭了对state、getters的对象本身层级的递归推导,避免由于过多过深的state或getter数据使ts推导瘫痪。

见:microsoft/TypeScript#30188

@hiyuki hiyuki merged commit 59c3216 into master Jan 13, 2021
@hiyuki hiyuki deleted the fix_core_types branch January 13, 2021 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants