Support import fix even when the error is that a type is used as a value (#23655)

This commit is contained in:
Andy 2018-04-24 08:54:14 -07:00 committed by GitHub
parent b1baca565b
commit eca17ac243
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View file

@ -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

View 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>();`,
]);