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
Support Actual extends Expected
in conjunction with Expected extends Actual
#2964
Labels
Comments
I think this would be great. Would there be any compatibility issues with existing code? |
novemberborn
added
help wanted
scope:typescript
enhancement
new functionality
and removed
needs triage
labels
Feb 13, 2022
I don't believe this change would introduce any compatibility issues. |
@RebeccaStevens do you want to submit a PR for this? |
RebeccaStevens
added a commit
to RebeccaStevens/ava
that referenced
this issue
Feb 14, 2022
…ring that it must be the otherway around fix avajs#2964
RebeccaStevens
added a commit
to RebeccaStevens/ava
that referenced
this issue
Feb 14, 2022
…ring that it must be the other way around fix avajs#2964
RebeccaStevens
added a commit
to RebeccaStevens/ava
that referenced
this issue
Feb 22, 2022
RebeccaStevens
added a commit
to RebeccaStevens/ava
that referenced
this issue
Feb 22, 2022
RebeccaStevens
added a commit
to RebeccaStevens/ava
that referenced
this issue
Mar 4, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The Problem
The type
DeepEqualAssertion
requires that theExpected
type extends theActual
type.However, sometimes we want this relationship to be the other way around.
Consider the following example:
If the type of
actual
is inferred as{ foo: number[] }
then this does not extend the type ofexpected
which is{ readonly foo: readonly number[] }
. Thus TypeScript reports an error.Suggested Fix
Add a overload to
DeepEqualAssertion
to handle this case:The text was updated successfully, but these errors were encountered: