Skip to content

Commit

Permalink
Tweak docs
Browse files Browse the repository at this point in the history
  • Loading branch information
alangpierce committed Jul 6, 2021
1 parent 3f970d9 commit d11d908
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/parser/plugins/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1215,6 +1215,7 @@ export function tsTryParseExport(): boolean {
// export import A = B;
// export import type A = require("A");
if (isContextual(ContextualKeyword._type) && lookaheadType() !== tt.eq) {
// Eat a `type` token, unless it's actually an identifier name.
expectContextual(ContextualKeyword._type);
}
tsParseImportEqualsDeclaration();
Expand Down
7 changes: 3 additions & 4 deletions src/parser/traverser/statement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1069,22 +1069,21 @@ export function parseImport(): void {
const lookahead = lookaheadType();
if (lookahead === tt.name) {
// One of these `import type` cases:
// import type T = require('T')
// import type T = require('T');
// import type A from 'A';
expectContextual(ContextualKeyword._type);
if (lookaheadType() === tt.eq) {
tsParseImportEqualsDeclaration();
return;
}
// If this is a regular `import type`, then we already ate the type token,
// so proceed as normal.
// If this is an `import type...from` statement, then we already ate the
// type token, so proceed to the regular import parser.
} else if (lookahead === tt.star || lookahead === tt.braceL) {
// One of these `import type` cases, in which case we can eat the type token
// and proceed as normal:
// import type * as A from 'A';
// import type {a} from 'A';
expectContextual(ContextualKeyword._type);
// Fall through
}
// Otherwise, we are importing the name "type".
}
Expand Down

0 comments on commit d11d908

Please sign in to comment.