Skip to content

Commit 95b896b

Browse files
committed
Only check overlaps if we found an array/tuple in the intersection
1 parent f8752ad commit 95b896b

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

src/compiler/checker.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21201,16 +21201,21 @@ namespace ts {
2120121201
}
2120221202
arrayOrTupleConstituent = constituent;
2120321203
}
21204-
else {
21205-
const properties = getPropertiesOfType(constituent);
21206-
for (const property of properties) {
21207-
if (isNumericLiteralName(property.escapedName) || property.escapedName === "length" as __String) {
21208-
return undefined;
21204+
}
21205+
21206+
if (arrayOrTupleConstituent) {
21207+
for (const constituent of (type as IntersectionType).types) {
21208+
if (constituent !== arrayOrTupleConstituent) {
21209+
const properties = getPropertiesOfType(constituent);
21210+
for (const property of properties) {
21211+
if (isNumericLiteralName(property.escapedName) || property.escapedName === "length" as __String) {
21212+
return undefined;
21213+
}
2120921214
}
21210-
}
2121121215

21212-
if (some(getIndexInfosOfType(constituent))) {
21213-
return undefined;
21216+
if (some(getIndexInfosOfType(constituent))) {
21217+
return undefined;
21218+
}
2121421219
}
2121521220
}
2121621221
}

0 commit comments

Comments
 (0)