Conversation
Member
Author
|
@typescript-bot test it |
Collaborator
Collaborator
|
Hey @gabritto, the results of running the DT tests are ready. Everything looks the same! |
Collaborator
|
@gabritto Here are the results of running the user tests with tsc comparing Everything looks good! |
Collaborator
|
@gabritto Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Collaborator
|
@gabritto Here are the results of running the top 400 repos with tsc comparing Everything looks good! |
jakebailey
approved these changes
Feb 7, 2025
Member
jakebailey
left a comment
There was a problem hiding this comment.
😢
Should we keep the tests behind for the future, rather than deleting them?
Member
Author
I'll just revert this PR when I re-introduce narrowing for 5.9, so it will have the deleted tests again. |
This was referenced Feb 28, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As discussed in design meeting on Feb 4th, the current design for return type narrowing doesn't work well with object types, and that aspect needs to be fixed before the feature can be released.
My notes on the problem are here: https://gist.github.com/gabritto/b6ebd5f9fc2bb3cfc305027609e66bca
This PR reverts return type narrowing, but keeps the change where we check each branch of a conditional return expression separately, since that change, although a breaking one, uncovered bugs in vscode and Google.
My plan is to later fix return type narrowing and get the fixed version in TS again for the 5.9. The planned fix is to restrict return type narrowing for cases where we the function/return type distinguishes between primitive types or primitive and object types, e.g. cases where the parameter has type
string | numberorstring | string[]. These are the cases where regular type narrowing already works well, and avoids the problems mentioned in the notes. Then, on top of that restriction, we'll enable embedding the "narrowable" type parameter in an object type (see https://gist.github.com/gabritto/b6ebd5f9fc2bb3cfc305027609e66bca#alternative-2-embedding).