-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Fix mapped type instantiation circularity #46586
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
Conversation
@typescript-bot run dt |
Heya @ahejlsberg, I've started to run the parallelized Definitely Typed test suite on this PR at 7dc887f. You can monitor the build here. |
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.
Nice find 🪐
if (isArrayType(t) || t.flags & TypeFlags.Any && findResolutionCycleStartIndex(typeVariable, TypeSystemPropertyName.ImmediateBaseConstraint) < 0 && | ||
(constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, or(isArrayType, isTupleType))) { |
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.
One day, we should find an easy/reusable way to easily ask "is this true *assuming that there are no circularities?"
Today is not that day.
export type Evolvable<E extends Evolver> = { | ||
[P in keyof E]: never; | ||
}; | ||
export type Evolver<T extends Evolvable<any> = any> = { | ||
[key in keyof Partial<T>]: never; | ||
}; | ||
|
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.
Can you remove the export here, or make all of the types exported? This turned off .d.ts
emit for the rest of the file.
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.
Done!
DT tests look good, error in |
* Don't obtain constraint if doing so would cause circularity * Add regression test * Address CR feedback
Fixes #46582.