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
Can pass an object containing a readonly array as a request matching object.
What is the actual behavior?
TSC compares against each type in the union DataMatcher, fails to match on the type DataMatcherArray, reaches the last type in the union - DataMatcherMap - and raises a confusing error message, masking the root cause.
error TS2345: Argument of type 'Foo' is not assignable to parameter of type 'string | RegExp | Buffer | DataMatcherArray | DataMatcherMap | ((body: any) => boolean) | undefined'.
Type 'Foo' is not assignable to type 'DataMatcherMap'.
Index signature is missing in type 'Foo'.
Possible solution
Change the definition of DataMatcherArray, from this:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We try to do our best, but nock is maintained by volunteers and there is only so much we can do at a time. Thank you for your contributions.
What is the expected behavior?
Can pass an object containing a readonly array as a request matching object.
What is the actual behavior?
TSC compares against each type in the union
DataMatcher
, fails to match on the typeDataMatcherArray
, reaches the last type in the union -DataMatcherMap
- and raises a confusing error message, masking the root cause.Possible solution
Change the definition of
DataMatcherArray
, from this:To this:
How to reproduce the issue
Does the bug have a test case?
No, it affects the type definitions.
Versions
13.0.7
v14.15.4
4.1.3
The text was updated successfully, but these errors were encountered: