mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-20 05:17:43 -05:00
Add check for undefined declarations
This commit is contained in:
@@ -198,11 +198,11 @@ namespace ts.GoToDefinition {
|
||||
return false;
|
||||
}
|
||||
|
||||
function tryAddSignature(signatureDeclarations: Declaration[], selectConstructors: boolean, symbolKind: string, symbolName: string, containerName: string, result: DefinitionInfo[]) {
|
||||
function tryAddSignature(signatureDeclarations: Declaration[] | undefined, selectConstructors: boolean, symbolKind: string, symbolName: string, containerName: string, result: DefinitionInfo[]) {
|
||||
const declarations: Declaration[] = [];
|
||||
let definition: Declaration | undefined;
|
||||
|
||||
for (const d of signatureDeclarations) {
|
||||
if (signatureDeclarations) for (const d of signatureDeclarations) {
|
||||
if (selectConstructors ? d.kind === SyntaxKind.Constructor : isSignatureDeclaration(d)) {
|
||||
declarations.push(d);
|
||||
if ((<FunctionLikeDeclaration>d).body) definition = d;
|
||||
|
||||
10
tests/cases/fourslash/goToDefinition_untypedModule.ts
Normal file
10
tests/cases/fourslash/goToDefinition_untypedModule.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: /node_modules/foo/index.js
|
||||
////not read
|
||||
|
||||
// @Filename: /a.ts
|
||||
////import { f } from "foo";
|
||||
/////**/f();
|
||||
|
||||
verify.goToDefinition("", []);
|
||||
Reference in New Issue
Block a user