TypeScript error

TS7006: Parameter implicitly has an 'any' type

  • Error TS7006
  • Reported with noImplicitAny
  • Reported with strict
  • Tested with TypeScript 5.9

error TS7006: Parameter 'name' implicitly has an 'any' type. appears when a function parameter has no type annotation, no default value and no type from its context, and noImplicitAny is on. strict: true turns noImplicitAny on, so this is usually the first error a JavaScript project meets after enabling strict mode.

TypeScript does not work out a parameter's type from the places the function is called. Without a type the parameter is any, which switches checking off for everything it touches; noImplicitAny turns that silent any into an error.

At a glance

CodeTS7006
MessageParameter '{0}' implicitly has an '{1}' type.
TypeScript's categoryerror
Listed underImplicit any
Turned on by noImplicitAny, strict
In .js files Reported when the file is checked: checkJs in jsconfig.json, or // @ts-check at the top of the file

The message is TypeScript's own text from its diagnostic messages file (Apache-2.0); {0} and {1} are filled in by tsc for each error.

What it looks like

greet.js Error confirmed 5.9.3 TypeScript 5.9.3, run 21 October 2026: greet.js(2,23): error TS7006: Parameter 'name' implicitly has an 'any' type. 6.0.3 TypeScript 6.0.3, run 21 October 2026: the same as 5.9.3. greet.js(2,23): error TS7006: Parameter 'name' implicitly has an 'any' type. 7.0.2 TypeScript 7.0.2, run 21 October 2026: the same as 5.9.3. greet.js(2,23): error TS7006: Parameter 'name' implicitly has an 'any' type. checked 21 October 2026
export function greet(name) {error TS7006: Parameter 'name' implicitly has an 'any' type.
  return `Hello, ${name}!`;
}
An untyped parameter under strict.
jsconfig.json for this example
{
  "compilerOptions": {
    "checkJs": true,
    "noEmit": true,
    "strict": true,
    "target": "es2022",
    "module": "nodenext",
    "types": []
  },
  "include": ["*.js"]
}

What causes it

  • The parameter has no @param tag, no default value, and the function is not passed straight to something that supplies its type (a callback to map, an event listener, a typed handler).
  • noImplicitAny is on, either directly or through strict.

How to fix it

Give the parameter a type with @param

Add a JSDoc comment above the function with one @param {Type} name line per parameter. This is the fix in almost every case, and it documents the function for editors and readers at the same time.

greet.js greet.ts TypeScript 5.9.3 TypeScript 5.9.3, run 21 October 2026: No errors. 6.0.3 TypeScript 6.0.3, run 21 October 2026: the same as 5.9.3. No errors. 7.0.2 TypeScript 7.0.2, run 21 October 2026: the same as 5.9.3. No errors. checked 21 October 2026
/**
 * @param {string} name
 */
export function greet(name) {
  return `Hello, ${name}!`;
}

export function farewell(name = "friend") {
  return `See you, ${name}.`;
}

["Ada", "Grace"].map((name) => greet(name));
export function greet(name: string) {
  return `Hello, ${name}!`;
}

export function farewell(name = "friend") {
  return `See you, ${name}.`;
}

["Ada", "Grace"].map((name) => greet(name));
Three ways the parameter gets a type.
jsconfig.json for this example
{
  "compilerOptions": {
    "checkJs": true,
    "noEmit": true,
    "strict": true,
    "target": "es2022",
    "module": "nodenext",
    "types": []
  },
  "include": ["*.js"]
}

Give it a default value

A default value carries a type: function farewell(name = "friend") makes name a string. Use it when the parameter is optional anyway.

Let the context supply the type

A function passed directly to something typed takes its parameter types from there: in ["Ada", "Grace"].map((name) => greet(name)) the arrow function's name is a string because the array is. A @type or @satisfies tag on a function expression works the same way.

Or relax the check while you migrate

Setting noImplicitAny: false (or leaving strict off) removes the error everywhere, and the parameters stay any. That is a reasonable first step in a large codebase, and it is what the relaxed level of the jsconfig generator does.

The same error in .js and .ts files

The error and its fixes are the same in both kinds of file; only the spelling of the annotation differs. In a .ts file you write name: string, in a .js file the type goes in the @param tag. The TypeScript tab on the fixed example shows the two side by side.

Gotchas

  • A @param tag whose name does not match the parameter does not fix the error. The parameter is still untyped (TS7006), and the checker reports the stray tag separately (TS8024).
  • Destructured parameters get one tag for the whole object: @param {{ id: string, name: string }} user above function show({ id, name }). The tag's name is yours to choose.
  • Callbacks are only typed by their context when they are passed directly. A function defined on its own line and passed later needs its own @param tags.

Questions

Why doesn't TypeScript infer the type from how I call the function?

Types flow from a function's body and its context to its callers, not back from the call sites. With noImplicitAny off, editors offer a quick fix that suggests types from usage (TS7044), but the checker never applies it on its own.

Sources

Last reviewed 20 October 2026.