You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've got the following code, converted from JavaScript, where it works fine. The call to createLogic works, but for some reason the call to createLogicMiddleware doesn't- I get one of those beastly, console-filling TypeScript errors .
If I replace the payload type FetchPayload with any, and then do some type coercion to get the clientId from the payload, it compiles fine. If I specify the type of payload then createLogic works, and createLogicMiddleware gives me an error.
Any ideas? Really can't unpick this one, and the fact that it starts complaining about the optional Validate hook seems bizarre.
TypeScript error: Argument of type '(Override<Base<TestAppState, Action<string, FetchPayload, any>, string> & Validate<TestAppState, Action<string, FetchPayload, any>, Dependencies, undefined> & Process<...>, { ...; }> | Override<...>)[]' is not assignable to parameter of type '(Override<Base<TestAppState, Action<string, any, any>, string> & Validate<TestAppState, Action<string, any, any>, Dependencies, undefined> & Process<TestAppState, Action<string, any, any>, Dependencies, undefined>, { ...; }> | Override<...>)[]'.
Type 'Override<Base<TestAppState, Action<string, FetchPayload, any>, string> & Validate<TestAppState, Action<string, FetchPayload, any>, Dependencies, undefined> & Process<...>, { ...; }> | Override<...>' is not assignable to type 'Override<Base<TestAppState, Action<string, any, any>, string> & Validate<TestAppState, Action<string, any, any>, Dependencies, undefined> & Process<TestAppState, Action<string, any, any>, Dependencies, undefined>, { ...; }> | Override<...>'.
Type 'Override<Base<TestAppState, Action<string, FetchPayload, any>, string> & Validate<TestAppState, Action<string, FetchPayload, any>, Dependencies, undefined> & Process<TestAppState, Action<...>, Dependencies, undefined>, { ...; }>' is not assignable to type 'Override<Base<TestAppState, Action<string, any, any>, string> & Validate<TestAppState, Action<string, any, any>, Dependencies, undefined> & Process<TestAppState, Action<string, any, any>, Dependencies, undefined>, { ...; }> | Override<...>'.
Type 'Override<Base<TestAppState, Action<string, FetchPayload, any>, string> & Validate<TestAppState, Action<string, FetchPayload, any>, Dependencies, undefined> & Process<TestAppState, Action<...>, Dependencies, undefined>, { ...; }>' is not assignable to type 'Override<Base<TestAppState, Action<string, any, any>, string> & Validate<TestAppState, Action<string, any, any>, Dependencies, undefined> & Process<TestAppState, Action<string, any, any>, Dependencies, undefined>, { ...; }>'.
Types of property 'validate' are incompatible.
Type 'Hook<TestAppState, Action<string, FetchPayload, any>, Dependencies, undefined> | undefined' is not assignable to type 'Hook<TestAppState, Action<string, any, any>, Dependencies, undefined> | undefined'.
Type 'Hook<TestAppState, Action<string, FetchPayload, any>, Dependencies, undefined>' is not assignable to type 'Hook<TestAppState, Action<string, any, any>, Dependencies, undefined>'. TS2345
83 |
84 | return createLogicMiddleware<TestAppState, Dependencies>(
> 85 | [fetchClientInfoLogic],
| ^
86 | dependencies
87 | )
88 |
EDIT:
since I can't post a reply, here's a fix:
Just ran into this exact problem again. Always fun finding your own questions when googling for things. However, here's a new workaround: if you cast the type property of the logic to string the error goes away, i.e.
I've got the following code, converted from JavaScript, where it works fine. The call to
createLogic
works, but for some reason the call tocreateLogicMiddleware
doesn't- I get one of those beastly, console-filling TypeScript errors .If I replace the payload type
FetchPayload
withany
, and then do some type coercion to get the clientId from the payload, it compiles fine. If I specify the type of payload thencreateLogic
works, andcreateLogicMiddleware
gives me an error.Any ideas? Really can't unpick this one, and the fact that it starts complaining about the optional Validate hook seems bizarre.
And here's the error
EDIT:
since I can't post a reply, here's a fix:
Just ran into this exact problem again. Always fun finding your own questions when googling for things. However, here's a new workaround: if you cast the
type
property of the logic tostring
the error goes away, i.e.The text was updated successfully, but these errors were encountered: