Fix weak object relation check#26790
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 '{}' 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.
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.
# 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.