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

fix: optional payload inference #901

Merged
merged 2 commits into from
May 26, 2021
Merged

Conversation

tianzhich
Copy link
Collaborator

  1. Simplify the ExtractRematchDispatcherFromReducer type alias.
  2. Make the Inference of the optional payload (and meta) correctly.

@tianzhich tianzhich requested a review from semoal May 25, 2021 04:31
@github-actions
Copy link

github-actions bot commented May 25, 2021

size-limit report 📦

Path Size
./packages/core/dist/core.umd.production.min.js 1.42 KB (0%)
./packages/immer/dist/immer.umd.production.min.js 143 B (0%)
./packages/loading/dist/loading.umd.production.min.js 596 B (0%)
./packages/persist/dist/persist.umd.production.min.js 172 B (0%)
./packages/select/dist/select.umd.production.min.js 456 B (0%)
./packages/updated/dist/updated.umd.production.min.js 407 B (0%)

@tianzhich tianzhich linked an issue May 25, 2021 that may be closed by this pull request
@semoal
Copy link
Member

semoal commented May 25, 2021

Looks good mate, nice refactor :)

I've created a file called packages/core/test/ts_typings/dispatcher-typings.test.ts, to create tests of our typings related to dispatch, basically consists:

  • Reducers
    • With optional payload
    • With required payload
  • Effects
    • With optional payload
    • With required payload
    • With optional payload and rootState
    • With required payload and required rootstate

and saw that effects with optional payload was not working properly, take a look to this pr mate: #902

Co-authored-by: tianzhich <zhi.tian@yahoo.com>
@tianzhich tianzhich changed the base branch from main to improve-typing May 26, 2021 12:08
@tianzhich tianzhich merged commit 78351ce into improve-typing May 26, 2021
semoal added a commit that referenced this pull request Jun 10, 2021
* fix: optional payload inference

* fix: optional payload inference inside effects (#902)

Co-authored-by: tianzhich <zhi.tian@yahoo.com>

Co-authored-by: Sergio Moreno <sergiomorenoalbert@gmail.com>
@semoal semoal deleted the fix-type-inference branch July 5, 2021 15:14
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.

Improve Typescript dispatch reducers inference
2 participants