-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
listenerMiddleware
type error in matcher using custom actions.
#4641
Comments
Could you post what the type error you're getting is? #3862 is also likely related. |
Thank you for the swift response. Here is the ts-error:
This does provide
|
No, |
listenerMiddleware
type error in matcher and predicate using custom actions.listenerMiddleware
type error in matcher using custom actions.
OK. The explanation of the issue still holds for matchers. Any suggestions on how I could fix this in either a PR or a workaround in my codebase? |
have you checked out the issue i linked, and tried moving the |
Yes, just tried and that didn't help. It works as expected when using RTK defined actions such as below. But not when using custom built matcher functions. const myThunk = createAsyncThunk.....;
const myMatcher = isAnyOf(myThunk.fulfilled),
startListening({
matcher: myMatcher,
effect: (action, listenerApi) => {
expectTypeOf(action).toMatchTypeOf<typeof myThunk....>()
},
}) |
I have a codebase using legacy redux patterns and trying to slowly but steadily transition to using modern redux. I have a set of old Actions that are created similiar to
ExtraAction
mentioned below. When using thelistenerMiddleware
to add a set of type guards as matchers using theisAnyOf
utility as demonstrated below, I see a type error on the matcher.Also, it seems as the type inferred from the predicate (probably the matcher to) doesn't carry along into effect callback.The text was updated successfully, but these errors were encountered: