TypeScript's any type is, by design, the single most unsafe part of its type system. The any type indicates a type that can be anything and can be used in place of any other type. Using any is unsafe because the type disables many of TypeScript's type-checking features and hampers TypeScript's ability to provide developer assistance.
typescript-eslint includes several lint rules that help prevent unsafe practices around the any type. These rules flag uses of any or code patterns that sneakily introduce it.
In this blog post, we'll show you those lint rules and several other handy ways to prevent anys from sneaking into your code.
TypeScript includes a noImplicitAny flag to report when a better type than any can't be inferred for a value. noImplicitAny is part of its family of strict compiler options and is generally recommended for all projects.
However, even with noImplicitAny enabled, the any type can easily be introduced into codebases. noImplicitAny doesn't prevent developers from explicitly writing the any type in type type annotations. Some built-in APIs such as JSON.stringify and types such as Function can introduce the any type without triggering noImplicitAny.