Skip to content

Commit

Permalink
Include type-meaning 'extends' clause in auto-import fix list (#59853)
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanCavanaugh authored Dec 4, 2024
1 parent 42f893f commit 4105134
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/services/codefixes/importFixes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ const errorCodes: readonly number[] = [
Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode.code,
Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig.code,
Diagnostics.Cannot_find_namespace_0_Did_you_mean_1.code,
Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements.code,
Diagnostics.This_JSX_tag_requires_0_to_be_in_scope_but_it_could_not_be_found.code,
];

Expand Down
11 changes: 10 additions & 1 deletion tests/cases/fourslash/importNameCodeFix_all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
////declare function e(): void;
////export = e;

// @Filename: /disposable.d.ts
////export declare class Disposable { }

// @Filename: /disposable_global.d.ts
////interface Disposable { }

// @Filename: /user.ts
////import * as b from "./b";
////import { } from "./c";
Expand All @@ -31,6 +37,7 @@
////cd; cd; c0; c0;
////dd; dd; d0; d0; d1; d1;
////e; e;
////class X extends Disposable { }

goTo.file("/user.ts");
verify.codeFixAll({
Expand All @@ -41,11 +48,13 @@ verify.codeFixAll({
import bd, * as b from "./b";
import cd, { c0 } from "./c";
import dd, { d0, d1 } from "./d";
import { Disposable } from "./disposable";
import e = require("./e");
ad; ad; a0; a0;
bd; bd; b.b0; b.b0;
cd; cd; c0; c0;
dd; dd; d0; d0; d1; d1;
e; e;`,
e; e;
class X extends Disposable { }`,
});

0 comments on commit 4105134

Please sign in to comment.