[ts] Allow optional binding pattern parameters within types/interfaces (#12227)
This commit is contained in:
@@ -2573,7 +2573,11 @@ 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" && !this.state.isDeclareContext) {
|
||||
if (
|
||||
param.type !== "Identifier" &&
|
||||
!this.state.isDeclareContext &&
|
||||
!this.state.inType
|
||||
) {
|
||||
this.raise(param.start, TSErrors.PatternIsOptional);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user