-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Treat void-typed properties as optional #40823
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 perf test |
Heya @rbuckton, I've started to run the perf test suite on this PR at be9b85d. You can monitor the build here. Update: The results are in! |
@rbuckton Here they are:Comparison Report - master..40823
System
Hosts
Scenarios
|
The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master. |
be9b85d
to
7e73fef
Compare
7e73fef
to
d261d4d
Compare
@rbuckton where did we land on this? I remember discussing something like this in the design meeting, but not whether we decided to go forward with it. |
@rbuckton do you mind if I close this until we come up with a comprehensive reform of |
Closing this for now. |
This treats
void
-typed properties (or properties with avoid
constituent) as optional for the purpose of assignability. This is similar to how we treat trailingvoid
parameters in signatures. The primary intended use case is to address an ECMAScript spec-compliance issue withIteratorResult
, though this has possibly further-reaching consequences than just that change:Unfortunately, simply making
value
optional isn't an option as it would make the result ofyield*
essentially always optional, as well as the result from calling.next()
when iteration has completed. For example:I did consider changing the type of
IteratorResult
:However that would require adding additional complexity to
getIterationTypesOfIteratorResult
to extract iteration types, and I'm also concerned that changingIteratorResult
in this way would cause issues with assignability for existing custom iterators.Fixes #38479