Lingua-e
JavaScript

What is a TS7006: Implicit Any?

← Errors

TypeScript error TS7006 is reported when a function parameter has no type annotation and TypeScript cannot infer its type, so it would default to 'any'. With noImplicitAny enabled (included in strict mode), TypeScript rejects this because 'any' disables type checking.

Why it happens

  • A function parameter is declared without a type annotation.
  • A variable is declared with let or const without an annotation and no initializer.
  • A callback parameter is not typed and TypeScript cannot infer it from context.

Examples

JavaScript

Code that triggers the error

// tsconfig: "strict": true
function greet(name) {
  return "Hello, " + name;
}

Error output

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

How to fix it

Add explicit type annotations to all function parameters. Enable TypeScript's strict mode to catch these issues early. If the type is genuinely unknown, prefer 'unknown' over 'any' and narrow it with type guards before use.

Fixed code

function greet(name: string): string {
  return "Hello, " + name;
}

Related errors

Ready to practice your English at work?

Lingua-e has interactive exercises built around real developer conversations: standups, code reviews, retrospectives, and more. Practice until it comes naturally.

Try Lingua-e for free