Skip to content

Commit

Permalink
Update packages/babel-parser/src/plugins/typescript/index.js
Browse files Browse the repository at this point in the history
Co-authored-by: Nicol貌 Ribaudo <nicolo.ribaudo@gmail.com>
  • Loading branch information
fedeci and nicolo-ribaudo committed Feb 10, 2021
1 parent 953bda2 commit ee05451
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions packages/babel-parser/src/plugins/typescript/index.js
Expand Up @@ -1617,15 +1617,19 @@ export default (superClass: Class<Parser>): Class<Parser> =>
break;

case "module":
if (!next || !this.hasFollowingLineBreak()) {
if (next) this.next();
if (!this.isLineTerminator()) {
if (this.match(tt.string)) {
return this.tsParseAmbientExternalModuleDeclaration(node);
} else if (this.match(tt.name)) {
return this.tsParseModuleOrNamespaceDeclaration(node);
}
}
// "module" cannot be followed by a line break.
if (next) {
if (this.hasFollowingLineBreak()) break;
this.next();
} else if (this.isLineTerminator()) {
break;
}

if (this.match(tt.string)) {
return this.tsParseAmbientExternalModuleDeclaration(node);
} else if (this.match(tt.name)) {
return this.tsParseModuleOrNamespaceDeclaration(node);
}
}
break;

Expand Down

0 comments on commit ee05451

Please sign in to comment.