From 4335f4462cefefdfd2068e4cdf8685a1de5bd3a9 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 28 Jan 2019 08:58:18 -0800 Subject: [PATCH] Tuples are known to be covaraint --- src/compiler/checker.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 805fb77efad..7a037440b6c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -13287,11 +13287,8 @@ namespace ts { } function getVariances(type: GenericType): Variance[] { - if (!strictFunctionTypes) { - return emptyArray; - } - if (type === globalArrayType || type === globalReadonlyArrayType) { - // Arrays are known to be covariant, no need to spend time computing this (emptyArray implies covariance for all parameters) + // Arrays and tuples are known to be covariant, no need to spend time computing this (emptyArray implies covariance for all parameters) + if (!strictFunctionTypes || type === globalArrayType || type === globalReadonlyArrayType || type.objectFlags & ObjectFlags.Tuple) { return emptyArray; } return getVariancesWorker(type.typeParameters, type, getMarkerTypeReference);