Skip to content

Commit 4335f44

Browse files
committed
Tuples are known to be covaraint
1 parent cd1f289 commit 4335f44

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13287,11 +13287,8 @@ namespace ts {
1328713287
}
1328813288

1328913289
function getVariances(type: GenericType): Variance[] {
13290-
if (!strictFunctionTypes) {
13291-
return emptyArray;
13292-
}
13293-
if (type === globalArrayType || type === globalReadonlyArrayType) {
13294-
// Arrays are known to be covariant, no need to spend time computing this (emptyArray implies covariance for all parameters)
13290+
// Arrays and tuples are known to be covariant, no need to spend time computing this (emptyArray implies covariance for all parameters)
13291+
if (!strictFunctionTypes || type === globalArrayType || type === globalReadonlyArrayType || type.objectFlags & ObjectFlags.Tuple) {
1329513292
return emptyArray;
1329613293
}
1329713294
return getVariancesWorker(type.typeParameters, type, getMarkerTypeReference);

0 commit comments

Comments
 (0)