TypeScript/tests/cases/fourslash/codeFixUnusedIdentifier_suggestion.ts
Nathan Shively-Sanders ec0e8cbe2b
noImplicitAny as suggestion (#27693)
* noImplicitAny as suggestion

Note that not all noImplicitAny errors turn into suggestions. In
particular,

1. reportErrorsFromWidening does not, because it doesn't log an error
that infer-from-usage fixes, and fixing it would require
otherwise-unnecessary code.
2. auto types do not have implicit any suggestions, because that would
require running control flow in noImplicitAny mode.

* Rename reportImplicitAny+forbid it for non-checkJS

In JS, you only get implicit any errors/suggestions with checkJS or
ts-check turned on.

* Update baselines

* Use isCheckJsEnabledForFile

* Remove noImplicitAny parameter since it's in scope already
2018-10-11 16:15:38 -07:00

30 lines
757 B
TypeScript

/// <reference path='fourslash.ts' />
////function f([|p|]) {
//// const [|x|] = 0;
////}
const [r0, r1] = test.ranges();
verify.getSuggestionDiagnostics([
{
message: "Parameter 'p' implicitly has an 'any' type.",
range: r0,
code: 7006,
},
{
message: "'p' is declared but its value is never read.",
range: r0,
code: 6133,
reportsUnnecessary: true,
},
{
message: "'x' is declared but its value is never read.",
range: r1,
code: 6133,
reportsUnnecessary: true,
}
]);
verify.codeFixAvailable(
["Remove declaration for: 'p'", "Prefix 'p' with an underscore", "Remove declaration for: 'x'"]
.map(description => ({ description })));