Error AtlasError Documentation and Resolution

TypeScript parameter implicitly has an any type

error TS7006: Parameter 'X' implicitly has an 'any' type.

TypeScript reported a function parameter with no explicit type and no safe inference under noImplicitAny rules.

TS7006build
error TS7006: Parameter 'X' implicitly has an 'any' type.
  • A function parameter has no declared type and TypeScript cannot infer one safely.
  • The project enables noImplicitAny, so silent any inference is treated as an error.
  • A callback or utility function lost contextual typing during refactoring.
  1. Locate the parameter named in the diagnostic and inspect its callers. Choose the actual input type rather than adding any just to silence the compiler.
  2. For a standalone function, annotate the parameter (for example name: string). For a callback, type the collection or function signature so contextual typing can infer its argument.
  3. If the value comes from untrusted input, accept unknown and validate it before use. An annotation does not validate JSON at runtime.
  4. Keep noImplicitAny enabled where possible. strict enables it unless explicitly overridden; disabling it project-wide hides other missing types.
  5. Run your project TypeScript check (usually npx tsc --noEmit -p tsconfig.json) and test callers. Check that the editor uses the workspace compiler if editor and build disagree.

Annotate a standalone parameter

Before

function greet(name) {
  return name.toUpperCase();
}
greet("Ada");

After

function greet(name: string) {
  return name.toUpperCase();
}
greet("Ada");

With noImplicitAny, the first function reports TS7006. A later call does not infer the declaration parameter type. The corrected example compiles and returns ADA. This pattern works in current TypeScript 5.x and 6.x.

Let a typed array supply callback context

Before

const format = (name) => name.toUpperCase();

After

const names: string[] = ["Ada"];
const upper = names.map(name => name.toUpperCase());

The standalone callback has no contextual parameter type. map on string[] supplies string automatically, so the corrected example needs no explicit parameter annotation.

TypeScript TSConfig: noImplicitAny