-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Fix weak object relation check #26790
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 test this |
Heya @ahejlsberg, I've started to run the extended test suite on this PR at a35c496. You can monitor the build here. It should now contribute to this PR's status checks. |
Type 'number | {}' is not assignable to type 'number'. | ||
Type '{}' is not assignable to type 'number'. | ||
Type 'number | {}' is not assignable to type 'number'. | ||
Type '{}' is not assignable to type 'number'. | ||
tests/cases/compiler/tupleTypes.ts(50,1): error TS2322: Type '[number, number]' is not assignable to type '[number, string]'. |
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 looked for explicit tuple-tuple relations in isRelatedTo and couldn't find it. Can you point me to it?
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.
# Conflicts: # tests/baselines/reference/infiniteConstraints.errors.txt
What if the array side is more specific than just array? interface TupleOfMillion extends Array<number> {
0: 1000000;
length: 1;
}
var tmillion: TupleOfMillion, tten: [10];
tmillion = tten; // Type '10' is not assignable to type '1000000'.
tten = tmillion; // Type '1000000' is not assignable to type '10'. |
@mihailik The optimization only applies to checks between tuples and |
This PR optimizes two code paths:
Fixes #26756.