Skip to content

Commit dd63656

Browse files
committed
Address CR feedback
1 parent 840214f commit dd63656

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9312,12 +9312,11 @@ namespace ts {
93129312
propType;
93139313
}
93149314
if (everyType(objectType, isTupleType) && isNumericLiteralName(propName) && +propName >= 0) {
9315-
const restType = mapType(objectType, t => getRestTypeOfTupleType(<TupleTypeReference>t) || undefinedType);
9316-
if (restType === undefinedType && accessNode) {
9315+
if (accessNode && everyType(objectType, t => !(<TupleTypeReference>t).target.hasRestElement)) {
93179316
const indexNode = accessNode.kind === SyntaxKind.ElementAccessExpression ? accessNode.argumentExpression : accessNode.indexType;
93189317
error(indexNode, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(propName), typeToString(objectType));
93199318
}
9320-
return restType;
9319+
return mapType(objectType, t => getRestTypeOfTupleType(<TupleTypeReference>t) || undefinedType);
93219320
}
93229321
}
93239322
if (!(indexType.flags & TypeFlags.Nullable) && isTypeAssignableToKind(indexType, TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.ESSymbolLike)) {

0 commit comments

Comments
 (0)