Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/services/codefixes/fixCannotFindModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
namespace ts.codefix {
registerCodeFix({
errorCodes: [
Diagnostics.Cannot_find_module_0.code,
Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type.code,
],
getCodeActions: context => {
Expand Down
11 changes: 10 additions & 1 deletion tests/cases/fourslash/codeFixCannotFindModule.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
/// <reference path='fourslash.ts' />

////import * as abs from "abs";
// @moduleResolution: node
// @noImplicitAny: true

// @Filename: /node_modules/abs/index.js
////not read

// @Filename: /a.ts
/////**/import * as abs from "abs";

test.setTypesRegistry({
"abs": undefined,
});

goTo.marker();

verify.codeFixAvailable([{
description: "Install '@types/abs'",
commands: [{
Expand Down
11 changes: 11 additions & 0 deletions tests/cases/fourslash/codeFixCannotFindModule_notIfMissing.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/// <reference path='fourslash.ts' />

// @Filename: /a.ts
////import * as abs from "abs";

test.setTypesRegistry({
"abs": undefined,
});

// We only give the fix for an implicit-any module, not for a missing module.
verify.not.codeFixAvailable();