Skip to content

Commit eca17ac

Browse files
author
Andy
authoredApr 24, 2018
Support import fix even when the error is that a type is used as a value (microsoft#23655)
1 parent b1baca5 commit eca17ac

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed
 

‎src/services/codefixes/importFixes.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ namespace ts.codefix {
77
Diagnostics.Cannot_find_name_0.code,
88
Diagnostics.Cannot_find_name_0_Did_you_mean_1.code,
99
Diagnostics.Cannot_find_namespace_0.code,
10-
Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code
10+
Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code,
11+
Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here.code,
1112
],
1213
getCodeActions: getImportCodeActions,
1314
// TODO: GH#20315
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
// @Filename: /a.ts
4+
////export class ReadonlyArray<T> {}
5+
6+
// @Filename: /b.ts
7+
////[|new ReadonlyArray<string>();|]
8+
9+
goTo.file("/b.ts");
10+
verify.importFixAtPosition([
11+
`import { ReadonlyArray } from "./a";
12+
13+
new ReadonlyArray<string>();`,
14+
]);

0 commit comments

Comments
 (0)
Please sign in to comment.