TS7006: Parameter 'x' implicitly has an 'any' type

Quick answer

A function parameter has no type and TypeScript can't infer one, so under noImplicitAny (part of strict) it errors instead of silently using any. Fix it one of these ways:

  • Annotate the parameter directly: (name: string).
  • Type the array/function so a callback parameter is inferred: give items the type Item[].
  • Give an event handler its DOM type: (e: MouseEvent).
  • Migrating from JS? Annotate x: any explicitly — don't disable the check.

The exact error string

function greet(name) {
  return `Hello, ${name}`;
}
// error TS7006: Parameter 'name' implicitly has an 'any' type.

const data = JSON.parse(raw);
const names = data.map((item) => item.name);
// error TS7006: Parameter 'item' implicitly has an 'any' type.

TypeScript's job is to know the type of every value. When a parameter has no annotation, TypeScript tries to infer one from context — and when there's no context to infer from, it would have to fall back to any, which disables type-checking for that value entirely. The noImplicitAny flag (on by default in strict mode) turns that silent fallback into the TS7006 error, so the untyped value can't slip through unnoticed.

Fix 1: annotate the parameter

The direct fix, and the right one for a standalone function, is to state the type:

// ❌ name is implicitly any
function greet(name) { return `Hello, ${name}`; }

// ✅ annotate it
function greet(name: string) { return `Hello, ${name}`; }

Fix 2: type the source so callbacks infer for free

This is the subtler and more important case. Callback parameters usually don't need annotations — TypeScript infers them from the array or function they belong to. TS7006 shows up when that source is itself untyped:

// ❌ JSON.parse returns any, so data is any, so item is implicitly any
const data = JSON.parse(raw);
const names = data.map((item) => item.name);

// ✅ type the parsed data at its source — now item is inferred as User
interface User { id: number; name: string; }
const data: User[] = JSON.parse(raw);
const names = data.map((item) => item.name);   // item: User, no annotation needed

Notice the fix is on data, not on item. Annotating the callback parameter directly ((item: User) =>) also silences the error, but typing the source is better: it makes every downstream use of data type-safe, not just this one callback. Because JSON.parse returns any, parsed API responses are the single most common origin of TS7006 in real codebases — give the parsed value a real interface and a cascade of implicit-any errors disappears at once. Need that interface fast? Paste a sample response into JSON to TypeScript and it generates the type for you.

Fix 3: event handlers need their event type

A handler defined standalone has nothing to infer its parameter from:

// ❌ e is implicitly any
const onClick = (e) => console.log(e.clientX);

// ✅ annotate with the DOM event type
const onClick = (e: MouseEvent) => console.log(e.clientX);

// ✅ or attach inline, where the element supplies the type contextually
button.addEventListener("click", (e) => console.log(e.clientX));  // e: MouseEvent

In React, the equivalents are the framework's synthetic event types — React.ChangeEvent<HTMLInputElement>, React.MouseEvent, and so on — or, again, writing the handler inline on the JSX element so the prop's type provides the event type for you.

Fix 4: destructured parameters (TS7031's cousin)

Destructuring a parameter with no object type gives the same class of error (often reported as the closely related TS7031):

// ❌ the destructured object has no type
function render({ id, name }) { /* ... */ }

// ✅ type the whole parameter object
function render({ id, name }: { id: number; name: string }) { /* ... */ }

// ✅ or with a named interface
interface Props { id: number; name: string; }
function render({ id, name }: Props) { /* ... */ }

What NOT to do: disabling noImplicitAny

It's tempting to make the error vanish by setting "noImplicitAny": false — don't. That doesn't fix anything; it just re-hides every untyped parameter as any, which is most of the reason to use TypeScript in the first place. If you're migrating a large JavaScript codebase and need to move incrementally, annotate the specific parameter as x: any explicitly. That silences TS7006 for that one spot, documents that the any is deliberate, and keeps the check on everywhere else so you can tighten types file by file.

Related noImplicitAny errors

CodeWhere it firesTypical fix
TS7006a function parameter with no inferable typeannotate it, or type the source
TS7031a destructured (binding-element) parametertype the whole parameter object
TS7053obj[key] where key isn't keyof objtype the key, use keyof / Record
TS7034a variable whose type can't be determinedannotate the variable

Debugging checklist

Frequently Asked Questions

What does TS7006 'Parameter implicitly has an any type' mean?

You wrote a function parameter with no type annotation, and TypeScript couldn't infer one from context, so it would have to fall back to any. Because your project has noImplicitAny turned on (it's part of strict mode), TypeScript refuses to do that silently and reports TS7006 instead. The fix is to give the parameter a type, or arrange for the surrounding code to supply one.

How do I fix TS7006 quickly?

Add an explicit type annotation to the parameter: change function greet(name) to function greet(name: string). For a callback, type the array or function it belongs to so TypeScript can infer the parameter contextually — for example items.map((item: Item) => ...) or, better, give items the type Item[] so item is inferred automatically.

Why does my array callback parameter get TS7006 but sometimes not?

When the array has a known element type, TypeScript infers the callback parameter contextually and no annotation is needed — users.map(u => u.name) works if users is User[]. TS7006 appears when the array itself is untyped (for example it came from JSON.parse, which returns any, or an untyped function), so there's no context to infer from. Type the array at its source and the callback parameter resolves for free.

Should I just turn off noImplicitAny?

No — disabling noImplicitAny throws away most of the value of using TypeScript, because untyped parameters silently become any and stop being checked at all. If you're migrating a large JavaScript codebase and need breathing room, annotate the parameter as x: any explicitly (which documents the intent and silences the error) rather than turning the whole check off. Fix the real types incrementally.

Why do event handler parameters trigger TS7006?

An event handler assigned in a way TypeScript can't connect to a known event type has no context for its parameter. If you write const onClick = (e) => ... standalone, e is implicitly any. Annotate it with the right DOM event type — (e: MouseEvent) => ... — or attach the handler inline where the element's type provides the event type contextually, such as element.addEventListener('click', e => ...), where e is inferred as MouseEvent.

How is TS7006 different from TS7053 or TS7031?

They're all noImplicitAny errors for different syntax positions. TS7006 is a function parameter with no inferable type. TS7053 is an element access with an implicit any index (obj[key] where key isn't keyof obj). TS7031 is a binding-element implicit any, typically a destructured parameter like ({ id }) => ... with no type on the object. Same root cause — no type to infer — different place in the code.

More TypeScript & JSON errors

Browse the full reference, or turn a JSON sample into the interface that fixes this.

JSON to TypeScript TS7053: Implicit any index All Error References
About the author

Pasindu Ishan is a software developer based in Sri Lanka. He builds privacy-first developer tools at JSON Dev Tools.