-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 addMatcher
typings
#1895
Fix addMatcher
typings
#1895
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit e1a3231:
|
✔️ Deploy Preview for redux-starter-kit-docs ready! 🔨 Explore the source changes: e1a3231 🔍 Inspect the deploy log: https://app.netlify.com/sites/redux-starter-kit-docs/deploys/61eac4b909d3a80007e36694 😎 Browse the preview: https://deploy-preview-1895--redux-starter-kit-docs.netlify.app |
@crcarrick Ah... this isn't obvious at all, but you should just be able to run |
Tbh., I'm not even sure if the extraction step still works or if the CI actually uses it. I've used this PR to add some minor refactoring (introducing a new |
References #1861
Previously, the
action
argument passed down to thereducer
function ofaddMatcher(matcher, reducer)
would be incorrectly typed asAnyAction
when the type predicate being tested by thematcher
function didn't include atype
property.This PR attempts to resolve the issue:
ActionMatcher
fromA extends AnyAction
toA
.action
argument toAnyAction
when there is no type predicate.A
type argument withAnyAction
to satisfy the second type argument toCaseReducer
and offer better completion inside the reducer function.action
argument is now correctly typed.I was unable to accomplish this. I ran the monorepo
build
script and the @reduxjs/toolkitbuild
scripts but this file was never updated. All of thebuild:*
scripts in the @reduxjs/toolkit workspace's package.json file include the--skipExtraction
flag which seems like it would prevent the extraction tool from running.addMatcher()
andActionMatcher
are referenced in the etc/redux-toolkit.api.md file, so I think the file should be updated with this PR. If somebody could point me in the right direction on how to get the tooling to do that, I would be grateful.Thanks for taking the time to look at this and let me know what you all think!