Skip to content

Commit 9b526a0

Browse files
author
Andy Hanson
committed
Fix bug where array element is undefined
1 parent cea4838 commit 9b526a0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3397,7 +3397,7 @@ namespace ts {
33973397
const arity = getTypeReferenceArity(type);
33983398
const tupleConstituentNodes = mapToTypeNodes(typeArguments.slice(0, arity), context);
33993399
const hasRestElement = (<TupleType>type.target).hasRestElement;
3400-
if (tupleConstituentNodes && tupleConstituentNodes.length > 0) {
3400+
if (tupleConstituentNodes && tupleConstituentNodes.length >= arity) {
34013401
for (let i = (<TupleType>type.target).minLength; i < arity; i++) {
34023402
tupleConstituentNodes[i] = hasRestElement && i === arity - 1 ?
34033403
createRestTypeNode(createArrayTypeNode(tupleConstituentNodes[i])) :

0 commit comments

Comments
 (0)