- Notifications
You must be signed in to change notification settings - Fork 13.2k
Fix generic nullable checks#59437
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
base:main
Are you sure you want to change the base?
Fix generic nullable checks #59437
Uh oh!
There was an error while loading. Please reload this page.
Conversation
ahejlsberg commented Jul 26, 2024 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
ahejlsberg commented Jul 26, 2024
@typescript-bot test it |
typescript-bot commented Jul 26, 2024 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
typescript-bot commented Jul 26, 2024
@ahejlsberg Here are the results of running the user tests with tsc comparing Everything looks good! |
typescript-bot commented Jul 26, 2024
Hey @ahejlsberg, the results of running the DT tests are ready. Everything looks the same! |
typescript-bot commented Jul 26, 2024
@ahejlsberg Here they are:tscComparison Report - baseline..pr
System info unknown Hosts
Scenarios
Developer Information: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
typescript-bot commented Jul 26, 2024
@ahejlsberg Here are the results of running the top 400 repos with tsc comparing Something interesting changed - please have a look. Details
|
ahejlsberg commented Jul 29, 2024 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
The new errors in the top 400 repos tests are all the same: Functions that compare values of unconstrained generic types. Our existing behavior is to permit such comparisons--we only error when the types have constraints that explicitly include We should decide if we think erroring on generic operands that are possibly |
ahejlsberg commented Jul 30, 2024
We're going to wait for 5.7 on this one since it is technically a breaking change. |
jakebailey commented Jan 18, 2025
5.7 happened, and we're now at 5.8... should we do this? 😄 |
This PR builds on #59415 to implement the following in aggregate:
obj[key], whenobjandkeyboth have generic types we no longer require the constraint ofobjto be a non-nullable type. The rationale for this change is that whenkeyis a valid property name forobj, it must be becauseobjis of a non-nullable type, as discussed here.unknownto possibly benullorundefinedin--strictNullChecksmode. Previously, we would only consider generic types with constraints includingnullorundefinedto possibly be nullable.Fixes#50603.