mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-16 05:58:32 -06:00
Handle the require call in javascript file for getSymbolAtLocation
This helps in getting the alias symbol so that it can go to the definition of external module Fixes #9251
This commit is contained in:
parent
f4dc11427f
commit
18969b024d
@ -18436,6 +18436,9 @@ namespace ts {
|
||||
(<ImportDeclaration>node.parent).moduleSpecifier === node)) {
|
||||
return resolveExternalModuleName(node, <LiteralExpression>node);
|
||||
}
|
||||
if (isInJavaScriptFile(node) && isRequireCall(node.parent, /*checkArgumentIsStringLiteral*/ false)) {
|
||||
return resolveExternalModuleName(node, <LiteralExpression>node);
|
||||
}
|
||||
// Fall through
|
||||
|
||||
case SyntaxKind.NumericLiteral:
|
||||
|
||||
11
tests/cases/fourslash/goToDefinitionJsModuleName.ts
Normal file
11
tests/cases/fourslash/goToDefinitionJsModuleName.ts
Normal file
@ -0,0 +1,11 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @allowJs: true
|
||||
// @Filename: foo.js
|
||||
/////*2*/module.exports = {};
|
||||
|
||||
// @Filename: bar.js
|
||||
////var x = require(/*1*/"./foo");
|
||||
|
||||
debugger;
|
||||
verify.goToDefinition("1", "2");
|
||||
Loading…
x
Reference in New Issue
Block a user