Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@babel/parser(ts): Add parsing of type import #9302

Merged
merged 8 commits into from Jan 10, 2019
5 changes: 4 additions & 1 deletion packages/babel-parser/src/plugins/typescript.js
Expand Up @@ -225,7 +225,10 @@ export default (superClass: Class<Parser>): Class<Parser> =>
this.expect(tt._import);
this.expect(tt.parenL);
if (!this.match(tt.string)) {
throw this.unexpected();
throw this.unexpected(
null,
"Argument in a type import must be an string literal",
armano2 marked this conversation as resolved.
Show resolved Hide resolved
);
}
node.argument = this.parseLiteral(this.state.value, "StringLiteral");
this.expect(tt.parenR);
Expand Down