Support import fix even when the error is that a type is used as a value (#23655)
This commit is contained in:
parent
b1baca565b
commit
eca17ac243
2 changed files with 16 additions and 1 deletions
|
@ -7,7 +7,8 @@ namespace ts.codefix {
|
|||
Diagnostics.Cannot_find_name_0.code,
|
||||
Diagnostics.Cannot_find_name_0_Did_you_mean_1.code,
|
||||
Diagnostics.Cannot_find_namespace_0.code,
|
||||
Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code
|
||||
Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code,
|
||||
Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here.code,
|
||||
],
|
||||
getCodeActions: getImportCodeActions,
|
||||
// TODO: GH#20315
|
||||
|
|
14
tests/cases/fourslash/importNameCodeFix_typeUsedAsValue.ts
Normal file
14
tests/cases/fourslash/importNameCodeFix_typeUsedAsValue.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @Filename: /a.ts
|
||||
////export class ReadonlyArray<T> {}
|
||||
|
||||
// @Filename: /b.ts
|
||||
////[|new ReadonlyArray<string>();|]
|
||||
|
||||
goTo.file("/b.ts");
|
||||
verify.importFixAtPosition([
|
||||
`import { ReadonlyArray } from "./a";
|
||||
|
||||
new ReadonlyArray<string>();`,
|
||||
]);
|
Loading…
Reference in a new issue