Skip to content

Commit

Permalink
Flow
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Oct 11, 2021
1 parent 1db66f6 commit d749763
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/babel-parser/src/plugins/typescript/index.js
Expand Up @@ -2872,7 +2872,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>

// Either way, we're looking at a '<': tt.jsxTagStart or relational.

let typeParameters: N.TsTypeParameterDeclaration;
let typeParameters: ?N.TsTypeParameterDeclaration;
state = state || this.state.clone();

const arrow = this.tryParse(abort => {
Expand Down Expand Up @@ -2900,7 +2900,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
// This error is reported outside of the this.tryParse call so that
// in case of <T>(x) => 2, we don't consider <T>(x) as a type assertion
// because of this error.
this.reportReservedArrowTypeParam(typeParameters);
if (typeParameters) this.reportReservedArrowTypeParam(typeParameters);
return arrow.node;
}

Expand All @@ -2927,7 +2927,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
if (arrow.node) {
/*:: invariant(arrow.failState) */
this.state = arrow.failState;
this.reportReservedArrowTypeParam(typeParameters);
if (typeParameters) this.reportReservedArrowTypeParam(typeParameters);
return arrow.node;
}

Expand All @@ -2944,7 +2944,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
throw jsx?.error || arrow.error || typeCast?.error;
}

reportReservedArrowTypeParam(node: N.TsTypeParameterDeclaration) {
reportReservedArrowTypeParam(node: any) {
if (
node.params.length === 1 &&
!node.extra?.trailingComma &&
Expand Down

0 comments on commit d749763

Please sign in to comment.