Skip to content

Commit dce7b6d

Browse files
Prevents auto import in module: "none" (#55556)
Co-authored-by: Andrew Branch <[email protected]>
1 parent 45e5a45 commit dce7b6d

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
// @module: none
4+
// @moduleResolution: node10
5+
// @target: es5
6+
7+
// @Filename: /node_modules/dep/index.d.ts
8+
////export const x: number;
9+
10+
// @Filename: /index.ts
11+
//// x/**/
12+
13+
verify.completions({
14+
marker: "",
15+
excludes: ["x"],
16+
preferences: {
17+
includeCompletionsForModuleExports: true,
18+
},
19+
});
20+
21+
edit.replaceLine(0, "import { x } from 'dep'; x;");
22+
verify.getSemanticDiagnostics([{
23+
range: { fileName: "/index.ts", pos: 0, end: "import { x } from 'dep';".length },
24+
code: ts.Diagnostics.Cannot_use_imports_exports_or_module_augmentations_when_module_is_none.code,
25+
message: ts.Diagnostics.Cannot_use_imports_exports_or_module_augmentations_when_module_is_none.message
26+
}]);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
// @module: none
4+
// @moduleResolution: node10
5+
// @target: es2015
6+
7+
// @Filename: /node_modules/dep/index.d.ts
8+
////export const x: number;
9+
10+
// @Filename: /index.ts
11+
//// x/**/
12+
13+
verify.completions({
14+
marker: "",
15+
includes: [{
16+
name: "x",
17+
source: "dep",
18+
sourceDisplay: "dep",
19+
hasAction: true,
20+
sortText: completion.SortText.AutoImportSuggestions
21+
}],
22+
preferences: {
23+
includeCompletionsForModuleExports: true,
24+
allowIncompleteCompletions: true,
25+
},
26+
});
27+
28+
edit.replaceLine(0, "import { x } from 'dep'; x;");
29+
verify.getSemanticDiagnostics([]);

0 commit comments

Comments
 (0)