Closed
Description
Search Terms
infer from usage suggestion
Suggestion
The infer from usage codefix only triggers from noImplicitAny errors, which are only available with noImplicitAny on. In particular, this makes it a lot less likely that JS users will use the codefix after #27610 is merged. Instead, noImplicitAny errors should be suggestions, which can trigger.
Use Cases
function f(x) {
return x + 1
}
// in JS, the codefix should produce this:
/**
* @param {number} x
*/
function f(x) {
return x + 1
}
This suggestion has a couple of problems:
- It would be difficult or at least slow to generate no-implicit-any errors without noImplicitAny: true, since the code paths are often quite different.
- inferFromUsage is not quite mature enough to be suggested everywhere to everybody all the time.
I'm working on (2), and (1) might not actually be a problem. A prototype is probably a good next step.