New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Declare matchers for use with expect.not.MATCHER (#385) #386
Declare matchers for use with expect.not.MATCHER (#385) #386
Conversation
Codecov Report
@@ Coverage Diff @@
## main #386 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 71 71
Lines 582 582
Branches 148 148
=========================================
Hits 582 582 Continue to review full report at Codecov.
|
Hey, is there anything blocking here that I can help with? this issue affects me too :) |
To give me a little more context on this, what autocompletion was this helping enable? With TypeScript projects in In VS Code? |
not related to vs code but typescript not compiling as he thinks these matchers can't be negated using |
I believe the reason this is happening is because of https://github.com/DefinitelyTyped/DefinitelyTyped/blob/658b4ded756f0c98e1a22e9592014c3c6bc4323a/types/jest/index.d.ts#L729. |
types/index.d.ts
Outdated
@@ -418,7 +418,7 @@ declare namespace jest { | |||
} | |||
|
|||
// noinspection JSUnusedGlobalSymbols | |||
interface Expect { | |||
interface AsymmetricMatchers { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's necessary to define this interface, because it's not one that is defined in @types/jest
. The AsymmetricMatchers
interface that is defined within Jest's native types of Expect
, JestExpect
, and Jasmine
. It is not referenced within any interface itself.
ef9b4ae
to
3a2218b
Compare
3a2218b
to
2a4ac3a
Compare
What
Move asymmetric matcher declarations to a new
AsymmetricMatchers
interface and extend that to add matchers toExpect
andInverseAsymmetricMatchers
.Why
This provides autocompletion when using
expect.not
, for example:Notes
This may not play nicely with actual TypeScript projects, but I do not have experience with that to verify. I didn't add any unit tests since I didn't change any code. TypeScript tests would be very useful for the project as a whole.
Housekeeping