Skip to main content

What it flags

An explicit any in TypeScript source: annotations such as : any, any[], Record<string, any> or Promise<any>, type arguments, as any, <any>value and catch (error: any). Each function signature, member, variable, type alias, cast or call is reported once, however many any tokens it holds. The finding is at the default level when the any is part of the module’s surface: an exported function’s parameters or return type, an exported type alias or interface, or a public member of an exported class, where the missing types spread to every caller. Other uses are contextual:
  • local variables, casts, call type arguments and catch variables;
  • any as a type argument of a generic other than the built-in containers (Array, Record, Promise, Map, Set, Partial, Readonly), or as a type parameter default, where it usually means “any instantiation” and unknown fails variance checks;
  • a line whose ESLint, oxlint or Biome no-explicit-any rule is switched off by a directive.
It stays quiet for extends constraints and conditional-type patterns such as T extends (...args: any[]) => any, which unknown cannot express; for the implementation signature of an overloaded function, which callers never see; and for value as any as T, which double-type-assertion reports. Declaration files, test, fixture and Storybook files, generated code (including GraphQL Code Generator output) and vendored code are skipped.

How to review

Name the real type where it is known. Otherwise use unknown and narrow the value before use, for example with typeof, instanceof Error or a schema. Replacing any with unknown usually needs those narrowing changes at each use, so there is no automatic fix. Mark a deliberate case with // loadwise-reviewed explicit-any -- <reason> on the line above.

Configuration

Set the rule to "off" in loadwise.config.json to drop its findings: