mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Optimize relationship checks for arrays and tuples
This commit is contained in:
@@ -11829,6 +11829,9 @@ namespace ts {
|
||||
errorInfo = saveErrorInfo;
|
||||
}
|
||||
}
|
||||
else if (isTupleType(source) && (isArrayType(target) || isReadonlyArrayType(target)) || isArrayType(source) && isReadonlyArrayType(target)) {
|
||||
return isRelatedTo(getIndexTypeOfType(source, IndexKind.Number) || anyType, getIndexTypeOfType(target, IndexKind.Number) || anyType, reportErrors);
|
||||
}
|
||||
// Even if relationship doesn't hold for unions, intersections, or generic type references,
|
||||
// it may hold in a structural comparison.
|
||||
// In a check of the form X = A & B, we will have previously checked if A relates to X or B relates
|
||||
|
||||
Reference in New Issue
Block a user