Skip to content

Commit

Permalink
Cherry-pick PR #32898 into release-3.6 (#32900)
Browse files Browse the repository at this point in the history
Component commits:
7f6543c Fix export=global auto import exclusion
  • Loading branch information
typescript-bot authored and RyanCavanaugh committed Aug 14, 2019
1 parent 0652f34 commit 5a0a671
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/services/completions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,7 @@ namespace ts.Completions {
if (resolvedModuleSymbol !== moduleSymbol &&
// Don't add another completion for `export =` of a symbol that's already global.
// So in `declare namespace foo {} declare module "foo" { export = foo; }`, there will just be the global completion for `foo`.
some(resolvedModuleSymbol.declarations, d => !!d.getSourceFile().externalModuleIndicator)) {
every(resolvedModuleSymbol.declarations, d => !!d.getSourceFile().externalModuleIndicator)) {
symbols.push(resolvedModuleSymbol);
symbolToSortTextMap[getSymbolId(resolvedModuleSymbol)] = SortText.AutoImportSuggestions;
symbolToOriginInfoMap[getSymbolId(resolvedModuleSymbol)] = { kind: SymbolOriginInfoKind.Export, moduleSymbol, isDefaultExport: false };
Expand Down
31 changes: 31 additions & 0 deletions tests/cases/fourslash/completionsImport_exportEquals_global.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/// <reference path="fourslash.ts" />

// @module: es6

// @Filename: /console.d.ts
////interface Console {}
////declare var console: Console;
////declare module "console" {
//// export = console;
////}

// @Filename: /react-native.d.ts
//// import 'console';
////declare global {
//// interface Console {}
//// var console: Console;
////}

// @Filename: /a.ts
////conso/**/

verify.completions({
exact: completion.globalsPlus([{
hasAction: undefined, // asserts that it does *not* have an action
name: "console"
}]),
preferences: {
includeCompletionsForModuleExports: true,
includeInsertTextCompletions: true
}
});

0 comments on commit 5a0a671

Please sign in to comment.