Skip to content

Commit 842c588

Browse files
committed
Exclude method symbols when relating tuple types
1 parent 8f3a917 commit 842c588

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/compiler/checker.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14123,9 +14123,11 @@ namespace ts {
1412314123
// 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_
1412414124
// from the target union, across all members
1412514125
const properties = target.flags & TypeFlags.Union ? getPossiblePropertiesOfUnionType(target as UnionType) : getPropertiesOfType(target);
14126+
const numericNamesOnly = isTupleType(source) && isTupleType(target);
1412614127
for (const targetProp of excludeProperties(properties, excludedProperties)) {
14127-
if (!(targetProp.flags & SymbolFlags.Prototype)) {
14128-
const sourceProp = getPropertyOfType(source, targetProp.escapedName);
14128+
const name = targetProp.escapedName;
14129+
if (!(targetProp.flags & SymbolFlags.Prototype) && (!numericNamesOnly || isNumericLiteralName(name) || name === "length")) {
14130+
const sourceProp = getPropertyOfType(source, name);
1412914131
if (sourceProp && sourceProp !== targetProp) {
1413014132
const related = propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSymbol, reportErrors, isIntersectionConstituent);
1413114133
if (!related) {

0 commit comments

Comments
 (0)