-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Allow nested conditionals to be related via constraints #37208
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
Allow nested conditionals to be related via constraints #37208
Conversation
@typescript-bot user test this |
Heya @weswigham, I've started to run the parallelized community code test suite on this PR at b554a2f. You can monitor the build here. |
Heya @weswigham, I've started to run the perf test suite on this PR at b554a2f. You can monitor the build here. Update: The results are in! |
Heya @weswigham, I've started to run the extended test suite on this PR at b554a2f. You can monitor the build here. |
Heya @weswigham, I've started to run the parallelized Definitely Typed test suite on this PR at b554a2f. You can monitor the build here. |
The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master. |
@weswigham Here they are:Comparison Report - master..37208
System
Hosts
Scenarios
|
Every test suite is either green or identical to master - this change seems good. |
src/compiler/checker.ts
Outdated
} | ||
} | ||
// while conditionals _can_ be related to one another via normal constraint, as, eg, `A extends B ? O : never` should be assignable to `O` | ||
// when `O` is a conditional (`never` is trivially aissgnable to `O`, as is `O`!). |
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 comment doesn't read right. Delete the leading "while"?
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.
Sure.
Fixes #30706
This allows a conditional to be related to another conditional via constraint. This means, notably, that conditionals which resolve to
? X : never
should now be assignable toX
, whereX
is another conditional type.