Do not throw an error for optional binding pattern params in function declaration (#12085)
This commit is contained in:
@@ -2526,7 +2526,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
// Allow type annotations inside of a parameter list.
|
||||
parseAssignableListItemTypes(param: N.Pattern) {
|
||||
if (this.eat(tt.question)) {
|
||||
if (param.type !== "Identifier") {
|
||||
if (param.type !== "Identifier" && !this.state.isDeclareContext) {
|
||||
this.raise(param.start, TSErrors.PatternIsOptional);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user