Skip to content

Commit

Permalink
fix(ts): include asserts in TSTypePredicate location (#12763)
Browse files Browse the repository at this point in the history
  • Loading branch information
fedeci committed Feb 5, 2021
1 parent eccbcca commit bf523da
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/babel-parser/src/plugins/typescript/index.js
Expand Up @@ -1068,6 +1068,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
node.asserts = true;
thisTypePredicate = this.finishNode(node, "TSTypePredicate");
} else {
this.resetStartLocationFromNode(thisTypePredicate, node);
(thisTypePredicate: N.TsTypePredicate).asserts = true;
}
t.typeAnnotation = thisTypePredicate;
Expand Down
Expand Up @@ -40,7 +40,7 @@
"start":21,"end":42,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":30}},
"typeAnnotation": {
"type": "TSTypePredicate",
"start":31,"end":42,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":30}},
"start":23,"end":42,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":30}},
"parameterName": {
"type": "TSThisType",
"start":31,"end":35,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":23}}
Expand Down Expand Up @@ -86,7 +86,7 @@
"start":58,"end":79,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":33}},
"typeAnnotation": {
"type": "TSTypePredicate",
"start":68,"end":79,"loc":{"start":{"line":3,"column":22},"end":{"line":3,"column":33}},
"start":60,"end":79,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":33}},
"parameterName": {
"type": "TSThisType",
"start":68,"end":72,"loc":{"start":{"line":3,"column":22},"end":{"line":3,"column":26}}
Expand Down Expand Up @@ -125,4 +125,4 @@
],
"directives": []
}
}
}

0 comments on commit bf523da

Please sign in to comment.