Skip to content

Commit

Permalink
Make asserts property boolean, not undefined (#12167)
Browse files Browse the repository at this point in the history
  • Loading branch information
sosukesuzuki committed Oct 13, 2020
1 parent d49e550 commit a5bed04
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/babel-parser/src/plugins/typescript/index.js
Expand Up @@ -1039,7 +1039,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
const t: N.TsTypeAnnotation = this.startNode();
this.expect(returnToken);

const asserts = this.tsTryParse(
const asserts = !!this.tsTryParse(
this.tsParseTypePredicateAsserts.bind(this),
);

Expand Down
Expand Up @@ -31,7 +31,8 @@
"type": "TSStringKeyword",
"start":15,"end":21,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":21}}
}
}
},
"asserts": false
}
},
"id": null,
Expand Down
Expand Up @@ -50,7 +50,8 @@
"type": "TSBooleanKeyword",
"start":25,"end":32,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":32}}
}
}
},
"asserts": false
}
},
"body": {
Expand All @@ -66,6 +67,10 @@
"expression": {
"type": "FunctionExpression",
"start":37,"end":70,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":34}},
"extra": {
"parenthesized": true,
"parenStart": 36
},
"id": null,
"generator": false,
"async": false,
Expand Down Expand Up @@ -102,18 +107,15 @@
"type": "TSBooleanKeyword",
"start":60,"end":67,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":31}}
}
}
},
"asserts": false
}
},
"body": {
"type": "BlockStatement",
"start":68,"end":70,"loc":{"start":{"line":2,"column":32},"end":{"line":2,"column":34}},
"body": [],
"directives": []
},
"extra": {
"parenthesized": true,
"parenStart": 36
}
}
}
Expand Down

0 comments on commit a5bed04

Please sign in to comment.