From 95b896b5fefae5ee5b7050f80b857ce742d427be Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 17 Jun 2022 11:20:36 -0700 Subject: [PATCH] Only check overlaps if we found an array/tuple in the intersection --- src/compiler/checker.ts | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 973d4271e25..09450cac8e8 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -21201,17 +21201,22 @@ namespace ts { } arrayOrTupleConstituent = constituent; } - else { - const properties = getPropertiesOfType(constituent); - for (const property of properties) { - if (isNumericLiteralName(property.escapedName) || property.escapedName === "length" as __String) { + } + + if (arrayOrTupleConstituent) { + for (const constituent of (type as IntersectionType).types) { + if (constituent !== arrayOrTupleConstituent) { + const properties = getPropertiesOfType(constituent); + for (const property of properties) { + if (isNumericLiteralName(property.escapedName) || property.escapedName === "length" as __String) { + return undefined; + } + } + + if (some(getIndexInfosOfType(constituent))) { return undefined; } } - - if (some(getIndexInfosOfType(constituent))) { - return undefined; - } } }