Skip to content

Commit

Permalink
Use isBinding to make typeCastToParameter decision
Browse files Browse the repository at this point in the history
  • Loading branch information
SakibulMowla committed Oct 30, 2019
1 parent a48a37a commit 35786c7
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions packages/babel-parser/src/plugins/typescript/index.js
Expand Up @@ -2427,10 +2427,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
toAssignableList(
exprList: N.Expression[],
isBinding: ?boolean,
contextDescription: string,
): $ReadOnlyArray<N.Pattern> {
const isAssignmentExpression =
contextDescription === "assignment expression";
for (let i = 0; i < exprList.length; i++) {
const expr = exprList[i];
if (!expr) continue;
Expand All @@ -2440,7 +2437,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
break;
case "TSAsExpression":
case "TSTypeAssertion":
if (isAssignmentExpression) {
if (!isBinding) {
exprList[i] = this.typeCastToParameter(expr);
} else {
this.raise(
Expand Down

0 comments on commit 35786c7

Please sign in to comment.