Make asserts property boolean, not undefined (#12167)

This commit is contained in:
Sosuke Suzuki 2020-10-14 06:56:08 +09:00 committed by GitHub
parent d49e5507ae
commit a5bed04f55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 8 deletions

View File

@ -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),
);

View File

@ -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,

View File

@ -50,7 +50,8 @@
"type": "TSBooleanKeyword",
"start":25,"end":32,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":32}}
}
}
},
"asserts": false
}
},
"body": {
@ -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,
@ -102,7 +107,8 @@
"type": "TSBooleanKeyword",
"start":60,"end":67,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":31}}
}
}
},
"asserts": false
}
},
"body": {
@ -110,10 +116,6 @@
"start":68,"end":70,"loc":{"start":{"line":2,"column":32},"end":{"line":2,"column":34}},
"body": [],
"directives": []
},
"extra": {
"parenthesized": true,
"parenStart": 36
}
}
}