fix import typeof in declare module (#10132)

This commit is contained in:
Tan Li Hau
2019-06-27 02:37:16 +08:00
committed by Brian Ng
parent 31fc1d06bc
commit 1d3f9815df
3 changed files with 111 additions and 38 deletions

View File

@@ -291,7 +291,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
if (this.match(tt._import)) {
this.next();
if (!this.isContextual("type") && !this.isContextual("typeof")) {
if (!this.isContextual("type") && !this.match(tt._typeof)) {
this.unexpected(
this.state.lastTokStart,
"Imports within a `declare module` body must always be `import type` or `import typeof`",