JamieMason / JamieMason/expect-more
expect-more-jest: Types missing from InverseAsymmetricMatchers
- Dominant language
- TypeScript
- Stars
- 172
- Forks
- 9
- PR merge metrics
- No merged PRs in 30d
Description
I tried `expect.not.toBeIso8601()` as an asymmetric matcher and got this error:
```
error TS2339: Property 'toBeIso8601' does not exist on type 'InverseAsymmetricMatchers'.
```
A fix like this needs to be done for every matcher. In the meantime, this same code works as a workaround in my user code:
```ts
declare global {
namespace jest {
interface InverseAsymmetricMatchers {
toBeIso8601(): any
}
}
}
```
P.S. I really appreciate this library. It gets the algebra correct and lets me reuse existing matchers (which throw errors with rich diffs) instead of making me write all-new predicates (that return `boolean` with no diffs) unlike `jest-extended`. Now I just have to get Jest to fix `toHaveBeenCalledWith` (and friends) to stop masking the rich diffs...
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating the TypeScript declaration for InverseAsymmetricMatchers and the matcher type definitions it should cover. Check how toBeIso8601 and the other matchers are exposed, then run the project's TypeScript checks and tests. Done means every matcher is available through the inverse asymmetric matcher type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100