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
If I try to use the captor function in a calledWith call (which accepts a Matcher) I get:
Argument of type '[CaptorMatcher<StateEntity<string, unknown>>]' is not assignable to parameter of type '[stateInstance: StateEntity<string, unknown>] | [stateInstance: StateEntity<string, unknown> | Matcher<StateEntity<string, unknown>>]'.
Type '[CaptorMatcher<StateEntity<string, unknown>>]' is not assignable to type '[stateInstance: StateEntity<string, unknown> | Matcher<StateEntity<string, unknown>>]'.
Type 'CaptorMatcher<StateEntity<string, unknown>>' is not assignable to type 'StateEntity<string, unknown> | Matcher<StateEntity<string, unknown>>'.
Property 'description' is missing in type 'CaptorMatcher<StateEntity<string, unknown>>' but required in type 'Matcher<StateEntity<string, unknown>>'.ts(2345)
Matchers.d.ts(4, 22): 'description' is declared here.
To me it seems that CaptorMatcher for some reason doesn't implement description, so Typescript complains.
If I do this however:
constc=captor<StateEntity<string,unknown>>();stateRepository.upsert.calledWith(casunknownasMatcher<StateEntity<string,unknown>>)// 👈 this part.mockReturnValue(TE.right(c.value));
then it works as intended. I suggest implementing description properly. This is a working implementation:
The text was updated successfully, but these errors were encountered:
adam-arold
changed the title
captor function is not working, it doesn't implement Matcher properly
The captor function causes type errors when used with calledWith.
May 3, 2023
If I try to use the
captor
function in acalledWith
call (which accepts aMatcher
) I get:To me it seems that
CaptorMatcher
for some reason doesn't implement description, so Typescript complains.If I do this however:
then it works as intended. I suggest implementing
description
properly. This is a working implementation:The text was updated successfully, but these errors were encountered: