Skip to content

Commit 26a8ffd

Browse files
author
Andy
committed
For @types installing quickfix, only activate for implicit-any module (#19394)
1 parent 43fc3ce commit 26a8ffd

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

src/services/codefixes/fixCannotFindModule.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
namespace ts.codefix {
33
registerCodeFix({
44
errorCodes: [
5-
Diagnostics.Cannot_find_module_0.code,
65
Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type.code,
76
],
87
getCodeActions: context => {

tests/cases/fourslash/codeFixCannotFindModule.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
/// <reference path='fourslash.ts' />
22

3-
////import * as abs from "abs";
3+
// @moduleResolution: node
4+
// @noImplicitAny: true
5+
6+
// @Filename: /node_modules/abs/index.js
7+
////not read
8+
9+
// @Filename: /a.ts
10+
/////**/import * as abs from "abs";
411

512
test.setTypesRegistry({
613
"abs": undefined,
714
});
815

16+
goTo.marker();
17+
918
verify.codeFixAvailable([{
1019
description: "Install '@types/abs'",
1120
commands: [{
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
// @Filename: /a.ts
4+
////import * as abs from "abs";
5+
6+
test.setTypesRegistry({
7+
"abs": undefined,
8+
});
9+
10+
// We only give the fix for an implicit-any module, not for a missing module.
11+
verify.not.codeFixAvailable();

0 commit comments

Comments
 (0)