Fix out-of-bounds issue in getParameterNameAtPosition

This commit is contained in:
Anders Hejlsberg 2019-03-01 16:34:09 -08:00
parent e383b0d4f7
commit 3afe0a4d43

View file

@ -21641,7 +21641,7 @@ namespace ts {
if (isTupleType(restType)) {
const associatedNames = (<TupleType>(<TypeReference>restType).target).associatedNames;
const index = pos - paramCount;
return associatedNames ? associatedNames[index] : restParameter.escapedName + "_" + index as __String;
return associatedNames && associatedNames[index] || restParameter.escapedName + "_" + index as __String;
}
return restParameter.escapedName;
}