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

This commit is contained in:
Andy 2017-10-23 13:36:36 -07:00 committed by GitHub
parent a9ffe0daeb
commit f916e38015
3 changed files with 21 additions and 2 deletions

View file

@ -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 => {

View file

@ -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: [{

View file

@ -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();