For @types installing quickfix, only activate for implicit-any module (#19394) (#19429)

This commit is contained in:
Andy
2017-10-24 08:05:13 -07:00
committed by GitHub
parent 43fc3ce503
commit 02cc07c7f8
3 changed files with 21 additions and 2 deletions
@@ -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 => {
@@ -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: [{
@@ -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();