• Error
  • Reported by the type checker

TS7006

Parameter '{0}' implicitly has an '{1}' type.

A function parameter has no type annotation and nothing gives it a type, so it would be `any`. Annotate the parameter.

What it means

Under noImplicitAny (part of strict), a parameter without a type annotation, default value or contextual type would silently be any. Callbacks passed to typed functions get their parameter types from context, so this mostly shows up on standalone functions and on callbacks passed to values typed any.

Example

index.ts
export function double(n) {
  return n * 2;
}
ts-r-check -p tsconfig.json --pretty false ts-r output
index.ts(1,24): error TS7006: Parameter 'n' implicitly has an 'any' type.

Recorded by node scripts/verify-examples.mjs with ts-r built from commit 6deaf01. The example uses the default tsconfig: strict, target: es2022, module: esnext, moduleResolution: bundler.

How to fix

  • Add a type annotation: function double(n: number).
  • Give the parameter a default value, which also gives it a type.
  • If the function is a callback, type the thing it is passed to so the parameter gets a contextual type.