Skip to content

Commit da52bad

Browse files
author
Kanchalai Tanglertsampan
committed
Address PR
1 parent f765233 commit da52bad

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/compiler/checker.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22665,16 +22665,12 @@ namespace ts {
2266522665
return undefined;
2266622666

2266722667
case SyntaxKind.StringLiteral:
22668-
// import x = require("./mo/*gotToDefinitionHere*/d")
22669-
if (isExternalModuleImportEqualsDeclaration(node.parent.parent) && getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) {
22670-
return resolveExternalModuleName(node, <LiteralExpression>node);
22671-
}
22672-
// External module name in an import declaration
22673-
if ((node.parent.kind === SyntaxKind.ImportDeclaration || node.parent.kind === SyntaxKind.ExportDeclaration) && (<ImportDeclaration>node.parent).moduleSpecifier === node) {
22674-
return resolveExternalModuleName(node, <LiteralExpression>node);
22675-
}
22676-
if ((isInJavaScriptFile(node) && isRequireCall(node.parent, /*checkArgumentIsStringLiteral*/ false)) ||
22677-
isImportCall(node.parent)) {
22668+
// 1). import x = require("./mo/*gotToDefinitionHere*/d")
22669+
// 2). External module name in an import declaration
22670+
// 3). Dynamic import call or require in javascript
22671+
if ((isExternalModuleImportEqualsDeclaration(node.parent.parent) && getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) ||
22672+
((node.parent.kind === SyntaxKind.ImportDeclaration || node.parent.kind === SyntaxKind.ExportDeclaration) && (<ImportDeclaration>node.parent).moduleSpecifier === node) ||
22673+
((isInJavaScriptFile(node) && isRequireCall(node.parent, /*checkArgumentIsStringLiteral*/ false)) || isImportCall(node.parent))) {
2267822674
return resolveExternalModuleName(node, <LiteralExpression>node);
2267922675
}
2268022676
// falls through

0 commit comments

Comments
 (0)