Allow trailing comma after rest parameter in TSDeclareFunction (#13101)
* fix(ts): allow trailing comma after rest parameter in `TSDeclareFunction` * Apply code review changes Co-Authored-By: Nicolò Ribaudo <7000710+nicolo-ribaudo@users.noreply.github.com>
This commit is contained in:
@@ -2789,6 +2789,18 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
return super.parseMaybeDecoratorArguments(expr);
|
||||
}
|
||||
|
||||
checkCommaAfterRest(close) {
|
||||
if (
|
||||
this.state.isDeclareContext &&
|
||||
this.match(tt.comma) &&
|
||||
this.lookaheadCharCode() === close
|
||||
) {
|
||||
this.next();
|
||||
} else {
|
||||
super.checkCommaAfterRest(close);
|
||||
}
|
||||
}
|
||||
|
||||
// === === === === === === === === === === === === === === === ===
|
||||
// Note: All below methods are duplicates of something in flow.js.
|
||||
// Not sure what the best way to combine these is.
|
||||
|
||||
Reference in New Issue
Block a user