-
-
Notifications
You must be signed in to change notification settings - Fork 571
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
Exact
: Fix usage with recursive types and unions
#949
Exact
: Fix usage with recursive types and unions
#949
Conversation
ecbfeed
to
031bcf6
Compare
test-d/exact.ts
Outdated
// @see https://github.com/sindresorhus/type-fest/issues/948 | ||
{ | ||
type A = { | ||
a: A; |
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.
Sorry, I don't understand this type. Looks like this is an infinite recursive type.
Do you actually mean the following?
type A = {
a: Expected;
}
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.
Ah, yes I think that's what I meant
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.
Fixed. I think it would also test the same case with a?: A
. As long as there's some sort of recursion in either of the types. TS doesn't even really care about the infinite recursion unless you try to actually instantiate or resolve the type 🤷
@abrenneke Sorry for the late reply. I think the implementation is OK but I have a question for the test case. |
031bcf6
to
7ebfa4a
Compare
Exact
: Fix usage with recursive types and unions
Fixes #948
This moves
IsEqual
to be the first check, before any distribution, restoring the behavior before #911.Wrote a test for it, and all tests are still passing, including those written for #911!