-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Unify substitution type any
handling into costruction and instantiation
#30592
Unify substitution type any
handling into costruction and instantiation
#30592
Conversation
@typescript-bot test this & @typescript-bot run dt go go go |
Heya @weswigham, I've started to run the Definitely Typed test suite on this PR at d5f32bd. You can monitor the build here. It should now contribute to this PR's status checks. |
Heya @weswigham, I've started to run the extended test suite on this PR at d5f32bd. You can monitor the build here. It should now contribute to this PR's status checks. |
The egg-mock and protractor DT failures are also from |
RWC diff is actually nil - test only failed because there's an unaccepted RWC diff on |
Wow, so the I can definitely special-case the all-any signature inside |
…rict variance doesnt kill subtyping
@typescript-bot test this & @typescript-bot run dt - I've confirmed |
Heya @weswigham, I've started to run the extended test suite on this PR at a2fcddc. You can monitor the build here. It should now contribute to this PR's status checks. |
Heya @weswigham, I've started to run the Definitely Typed test suite on this PR at a2fcddc. You can monitor the build here. It should now contribute to this PR's status checks. |
Remaining two DT failures are the two from |
*/ | ||
function isAnySignature(s: Signature) { | ||
return !s.typeParameters && (!s.thisParameter || isTypeAny(getTypeOfParameter(s.thisParameter))) && s.parameters.length === 1 && | ||
s.hasRestParameter && getTypeOfParameter(s.parameters[0]) === anyArrayType && |
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.
Also allow for (...args: any) => any
.
@ahejlsberg done. @typescript-bot test this & @typescript-bot run dt because this is an immediately-before-release fix and we like making sure we're not breaking people~ |
Heya @weswigham, I've started to run the extended test suite on this PR at 34cc427. You can monitor the build here. It should now contribute to this PR's status checks. |
Heya @weswigham, I've started to run the Definitely Typed test suite on this PR at 34cc427. You can monitor the build here. It should now contribute to this PR's status checks. |
DT's just as clean as before, this is good. ❤️ @ahejlsberg can you update your review status? |
const trueTypeNode = typeToTypeNodeHelper(getTrueTypeFromConditionalType(<ConditionalType>type), context); | ||
const falseTypeNode = typeToTypeNodeHelper(getFalseTypeFromConditionalType(<ConditionalType>type), context); | ||
const trueTypeNode = typeToTypeNodeHelper((<ConditionalType>type).trueType, context); | ||
const falseTypeNode = typeToTypeNodeHelper((<ConditionalType>type).falseType, context); |
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 thought <
angle brackets>
casting is meant to be phased out in favour of as
casting?
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.
The angle brackets were already here~
And clean up conditional types a little to match. The changes to conditional
resolvedTrueType
/resolvedFalseType
aren't strictly required, per sey, but they clean up a lot and reduce complexity. We were choosing not to cache types we'd already computed (for no real reason other than a misunderstanding on my part as to when thecombinedMapper
was used).Fixing the creation of substitutes to
any
exposed an issue where we'd generate infinitely expanding types in ourinfiniteConstraints.ts
test (which previously were never expanded because their assignment to a substitutedany
simply succeeded) - I had to both introduce type-parameter like circularity guards intogetConstraintOfType
for conditionals and indexed accesses (it was missing them), and further penalize deep instantiations of conditionals withincomputeBaseConstraint
(to capture the exponential explosion of types instantiated by circularly referential conditionals).Fixes #30569
Fixes #30489