Skip to content

Commit fc9bcc1

Browse files
author
Andy
authored
Merge pull request microsoft#14343 from Microsoft/undefined_declarations
Add check for undefined declarations
2 parents 4f1d7a5 + 7afee8c commit fc9bcc1

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/services/goToDefinition.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,11 @@ namespace ts.GoToDefinition {
198198
return false;
199199
}
200200

201-
function tryAddSignature(signatureDeclarations: Declaration[], selectConstructors: boolean, symbolKind: string, symbolName: string, containerName: string, result: DefinitionInfo[]) {
201+
function tryAddSignature(signatureDeclarations: Declaration[] | undefined, selectConstructors: boolean, symbolKind: string, symbolName: string, containerName: string, result: DefinitionInfo[]) {
202+
if (!signatureDeclarations) {
203+
return false;
204+
}
205+
202206
const declarations: Declaration[] = [];
203207
let definition: Declaration | undefined;
204208

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
// @Filename: /node_modules/foo/index.js
4+
////not read
5+
6+
// @Filename: /a.ts
7+
////import { f } from "foo";
8+
/////**/f();
9+
10+
verify.goToDefinition("", []);

0 commit comments

Comments
 (0)