Fix bug where array element is undefined (#26433)
* Fix bug where array element is undefined * Better fix
This commit is contained in:
parent
a5326e68d0
commit
bc709a87ad
1 changed files with 2 additions and 2 deletions
|
@ -3470,8 +3470,8 @@ namespace ts {
|
|||
const arity = getTypeReferenceArity(type);
|
||||
const tupleConstituentNodes = mapToTypeNodes(typeArguments.slice(0, arity), context);
|
||||
const hasRestElement = (<TupleType>type.target).hasRestElement;
|
||||
if (tupleConstituentNodes && tupleConstituentNodes.length > 0) {
|
||||
for (let i = (<TupleType>type.target).minLength; i < arity; i++) {
|
||||
if (tupleConstituentNodes) {
|
||||
for (let i = (<TupleType>type.target).minLength; i < Math.min(arity, tupleConstituentNodes.length); i++) {
|
||||
tupleConstituentNodes[i] = hasRestElement && i === arity - 1 ?
|
||||
createRestTypeNode(createArrayTypeNode(tupleConstituentNodes[i])) :
|
||||
createOptionalTypeNode(tupleConstituentNodes[i]);
|
||||
|
|
Loading…
Reference in a new issue