-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Suggestion: noInferredAny #39633
Copy link
Copy link
Open
Labels
Needs ProposalThis issue needs a plan that clarifies the finer details of how it could be implemented.This issue needs a plan that clarifies the finer details of how it could be implemented.SuggestionAn idea for TypeScriptAn idea for TypeScript
Metadata
Metadata
Assignees
Labels
Needs ProposalThis issue needs a plan that clarifies the finer details of how it could be implemented.This issue needs a plan that clarifies the finer details of how it could be implemented.SuggestionAn idea for TypeScriptAn idea for TypeScript
Type
Fields
Give feedbackNo fields configured for issues without a type.
Search Terms
noImplicitAny inference any noInferredAny
Suggestion
Symbols typed as
anyreduce the type safety of a program. That's fair if the programmer intended to useany. However it's relatively easy to end up with symbols typedanythrough type inference chains that are not obvious:any.d.tstypes default generic arguments toany(e.g.Set)In all these situations, a programmer might write
const foo = something();and expectfooto have a reasonable inferred type.foobeing inferred toanyis easy to miss in such code, both while editing and while reviewing code.Proposal: add a compiler option
noInferredAnythat flags symbols whose type is any and that do not have an explicit type annotation.Use Cases
Examples
Checklist
My suggestion meets these guidelines: