Skip to content

Commit

Permalink
[ts]Set false to default value of TsTypePredicate.asserts (#12352)
Browse files Browse the repository at this point in the history
  • Loading branch information
sosukesuzuki committed Nov 16, 2020
1 parent 56fd904 commit a4e4aed
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/babel-parser/src/plugins/typescript/index.js
Expand Up @@ -357,6 +357,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
const node: N.TsTypePredicate = this.startNodeAtNode(lhs);
node.parameterName = lhs;
node.typeAnnotation = this.tsParseTypeAnnotation(/* eatColon */ false);
node.asserts = false;
return this.finishNode(node, "TSTypePredicate");
}
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-parser/src/types.js
Expand Up @@ -1262,7 +1262,7 @@ export type TsTypePredicate = TsTypeBase & {
type: "TSTypePredicate",
parameterName: Identifier | TsThisType,
typeAnnotation: TsTypeAnnotation,
asserts?: boolean,
asserts: boolean,
};

// `typeof` operator
Expand Down
Expand Up @@ -52,7 +52,8 @@
"type": "TSStringKeyword",
"start":31,"end":37,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":25}}
}
}
},
"asserts": false
}
},
"body": {
Expand Down Expand Up @@ -92,7 +93,8 @@
"type": "TSStringKeyword",
"start":66,"end":72,"loc":{"start":{"line":4,"column":22},"end":{"line":4,"column":28}}
}
}
},
"asserts": false
}
},
"id": null,
Expand Down

0 comments on commit a4e4aed

Please sign in to comment.