From 842c588f3ef5b56bde3f71265d7bc7c243c539f6 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 28 Aug 2019 07:52:42 -0400 Subject: [PATCH] Exclude method symbols when relating tuple types --- src/compiler/checker.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 1231d4b31f1..529a357e34d 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -14123,9 +14123,11 @@ namespace ts { // We only call this for union target types when we're attempting to do excess property checking - in those cases, we want to get _all possible props_ // from the target union, across all members const properties = target.flags & TypeFlags.Union ? getPossiblePropertiesOfUnionType(target as UnionType) : getPropertiesOfType(target); + const numericNamesOnly = isTupleType(source) && isTupleType(target); for (const targetProp of excludeProperties(properties, excludedProperties)) { - if (!(targetProp.flags & SymbolFlags.Prototype)) { - const sourceProp = getPropertyOfType(source, targetProp.escapedName); + const name = targetProp.escapedName; + if (!(targetProp.flags & SymbolFlags.Prototype) && (!numericNamesOnly || isNumericLiteralName(name) || name === "length")) { + const sourceProp = getPropertyOfType(source, name); if (sourceProp && sourceProp !== targetProp) { const related = propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSymbol, reportErrors, isIntersectionConstituent); if (!related) {