Allow tuple rest trailing comma (#10800)
This commit is contained in:
@@ -618,7 +618,12 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
const restNode: N.TsRestType = this.startNode();
|
||||
this.next(); // skips ellipsis
|
||||
restNode.typeAnnotation = this.tsParseType();
|
||||
this.checkCommaAfterRest(charCodes.rightSquareBracket);
|
||||
if (
|
||||
this.match(tt.comma) &&
|
||||
this.lookaheadCharCode() !== charCodes.rightSquareBracket
|
||||
) {
|
||||
this.raiseRestNotLast(this.state.start);
|
||||
}
|
||||
return this.finishNode(restNode, "TSRestType");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user