-
Notifications
You must be signed in to change notification settings - Fork 381
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
Conversation
add chaining derivation support to mapState & mapGetters
fix createGettersWithThis's problem
新修复了一些问题,当使用createStoreWithThis创建store时,如果引入createStore创建的store会报错。此时采用老版本兼容方式处理。 |
packages/core/@types/mpx-store.d.ts
Outdated
dispatch(type: string, ...payload: any[]): any | ||
commit(type: string, ...payload: any[]): any |
There was a problem hiding this comment.
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)
如果想要重载现在看来只能采取这种迂回的方式。
优化了一下写法,后续如果统一使用createStoreWithThis之后可以直接出除去用于重载的interface |
关闭了对state、getters的对象本身层级的递归推导,避免由于过多过深的state或getter数据使ts推导瘫痪。 |
fix $forceUpdate's types