mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-19 00:42:28 -05:00
feat(44799): allow auto import codefix for shorthand property assignment (#44827)
This commit is contained in:
@@ -10,6 +10,7 @@ namespace ts.codefix {
|
||||
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_only_refers_to_a_type_but_is_being_used_as_a_value_here.code,
|
||||
Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer.code
|
||||
];
|
||||
|
||||
registerCodeFix({
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @Filename: /a.ts
|
||||
////export const a = 1;
|
||||
|
||||
// @Filename: /b.ts
|
||||
////const b = { /**/a };
|
||||
|
||||
goTo.file("/b.ts");
|
||||
verify.importFixAtPosition([
|
||||
`import { a } from "./a";
|
||||
|
||||
const b = { a };`
|
||||
]);
|
||||
@@ -0,0 +1,15 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @Filename: /a.ts
|
||||
////const a = 1;
|
||||
////export default a;
|
||||
|
||||
// @Filename: /b.ts
|
||||
////const b = { /**/a };
|
||||
|
||||
goTo.file("/b.ts");
|
||||
verify.importFixAtPosition([
|
||||
`import a from "./a";
|
||||
|
||||
const b = { a };`
|
||||
]);
|
||||
Reference in New Issue
Block a user