-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Loosen type constraints for deepEqual assertion #2969
Conversation
Cheers @RebeccaStevens. Could you add a test for this under https://github.com/avajs/ava/tree/main/test-d? |
Sure thing. Give me a few minutes. |
8a794e8
to
3029047
Compare
@novemberborn Done |
3029047
to
d2b0c2b
Compare
* Assert that `actual` is [deeply equal](https://github.com/concordancejs/concordance#comparison-details) to | ||
* `expected`, returning a boolean indicating whether the assertion passed. | ||
*/ | ||
<Actual, Expected>(actual: Actual, expected: Expected, message?: string): boolean; |
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.
Why do we need this overload? Wouldn't the assertion always fail if neither extend one another?
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.
If part of Expected
extends part of Actual
, but another part Expected
is a super type of Actual
, then neither extends the other but both my have the same value.
For example, imagine that one of the properties on Expected
is typed as readonly, while the corresponding property on Actual
isn't. And then for another property the two share, the readonlyness is declared the other way around.
d2b0c2b
to
39bac1d
Compare
Thanks @RebeccaStevens! |
fix #2964