Skip to content

Commit 4ccb3bb

Browse files
authored
Merge pull request #11511 from Microsoft/FixImportListCompletions
Resolve export= module members
2 parents 4fde1af + db5da0b commit 4ccb3bb

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

src/compiler/checker.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1465,6 +1465,10 @@ namespace ts {
14651465

14661466
function getExportsForModule(moduleSymbol: Symbol): SymbolTable {
14671467
const visitedSymbols: Symbol[] = [];
1468+
1469+
// A module defined by an 'export=' consists on one export that needs to be resolved
1470+
moduleSymbol = resolveExternalModuleSymbol(moduleSymbol);
1471+
14681472
return visit(moduleSymbol) || moduleSymbol.exports;
14691473

14701474
// The ES6 spec permits export * declarations in a module to circularly reference the module itself. For example,
@@ -17889,7 +17893,8 @@ namespace ts {
1788917893
}
1789017894

1789117895
function isNotOverload(declaration: Declaration): boolean {
17892-
return declaration.kind !== SyntaxKind.FunctionDeclaration || !!(declaration as FunctionDeclaration).body;
17896+
return (declaration.kind !== SyntaxKind.FunctionDeclaration && declaration.kind !== SyntaxKind.MethodDeclaration) ||
17897+
!!(declaration as FunctionDeclaration).body;
1789317898
}
1789417899
}
1789517900

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
// @Filename: foo.d.ts
4+
//// declare class Foo {
5+
//// static prop1(x: number): number;
6+
//// static prop1(x: string): string;
7+
//// static prop2(x: boolean): boolean;
8+
//// }
9+
//// export = Foo; /*2*/
10+
11+
// @Filename: app.ts
12+
////import {/*1*/} from './foo';
13+
14+
goTo.marker('1');
15+
verify.completionListContains('prop1');
16+
verify.completionListContains('prop2');
17+
verify.not.completionListContains('Foo');
18+
verify.numberOfErrorsInCurrentFile(0);
19+
goTo.marker('2');
20+
verify.numberOfErrorsInCurrentFile(0);

0 commit comments

Comments
 (0)