From da52bad4b8930564ca0ccf68d7dd287f3eada09a Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Tue, 13 Jun 2017 10:03:43 -0700 Subject: [PATCH] Address PR --- src/compiler/checker.ts | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c8a99b0bbb2..2ce83f570e2 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -22665,16 +22665,12 @@ namespace ts { return undefined; case SyntaxKind.StringLiteral: - // import x = require("./mo/*gotToDefinitionHere*/d") - if (isExternalModuleImportEqualsDeclaration(node.parent.parent) && getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) { - return resolveExternalModuleName(node, node); - } - // External module name in an import declaration - if ((node.parent.kind === SyntaxKind.ImportDeclaration || node.parent.kind === SyntaxKind.ExportDeclaration) && (node.parent).moduleSpecifier === node) { - return resolveExternalModuleName(node, node); - } - if ((isInJavaScriptFile(node) && isRequireCall(node.parent, /*checkArgumentIsStringLiteral*/ false)) || - isImportCall(node.parent)) { + // 1). import x = require("./mo/*gotToDefinitionHere*/d") + // 2). External module name in an import declaration + // 3). Dynamic import call or require in javascript + if ((isExternalModuleImportEqualsDeclaration(node.parent.parent) && getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || + ((node.parent.kind === SyntaxKind.ImportDeclaration || node.parent.kind === SyntaxKind.ExportDeclaration) && (node.parent).moduleSpecifier === node) || + ((isInJavaScriptFile(node) && isRequireCall(node.parent, /*checkArgumentIsStringLiteral*/ false)) || isImportCall(node.parent))) { return resolveExternalModuleName(node, node); } // falls through