Lingua-e
← Errors
JavaScript

TS7006: Implicit Any: What It Means and How to Fix It

Error reference

TS7006: Implicit Any

Language

JavaScript

Severity

Medium

When it happens

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'.

Potential fixes

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.

Deep dive

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.

Potential fixes

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.

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.

Fixed code

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

Practice in English

How would you explain a TS7006: Implicit Any to a fellow dev? Choose the right phrase:

"I hit an error...

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