mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
fix(56376): import type from from "foo" (#56385)
This commit is contained in:
@@ -7496,6 +7496,11 @@ namespace Parser {
|
||||
function nextTokenIsStringLiteral() {
|
||||
return nextToken() === SyntaxKind.StringLiteral;
|
||||
}
|
||||
|
||||
function nextTokenIsFromKeyword() {
|
||||
return nextToken() === SyntaxKind.FromKeyword;
|
||||
}
|
||||
|
||||
function nextTokenIsIdentifierOrStringLiteralOnSameLine() {
|
||||
nextToken();
|
||||
return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token() === SyntaxKind.StringLiteral);
|
||||
@@ -8328,8 +8333,8 @@ namespace Parser {
|
||||
|
||||
let isTypeOnly = false;
|
||||
if (
|
||||
token() !== SyntaxKind.FromKeyword &&
|
||||
identifier?.escapedText === "type" &&
|
||||
(token() !== SyntaxKind.FromKeyword || isIdentifier() && lookAhead(nextTokenIsFromKeyword)) &&
|
||||
(isIdentifier() || tokenAfterImportDefinitelyProducesImportDeclaration())
|
||||
) {
|
||||
isTypeOnly = true;
|
||||
|
||||
Reference in New Issue
Block a user