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
| Code | TS7006 |
|---|---|
| Message | Parameter '{0}' implicitly has an '{1}' type. |
| TypeScript's category | error |
| Listed under | Implicit 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
export function greet(name) {error TS7006: Parameter 'name' implicitly has an 'any' type.
return `Hello, ${name}!`;
}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
@paramtag, no default value, and the function is not passed straight to something that supplies its type (a callback tomap, an event listener, a typed handler). noImplicitAnyis on, either directly or throughstrict.
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.
/**
* @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));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
@paramtag 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 }} userabovefunction 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
@paramtags.
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
- TSConfig Reference: noImplicitAny · TypeScript
- TSConfig Reference: strict · TypeScript
- JSDoc Reference: @param and @returns · TypeScript handbook
- diagnosticMessages.json (TypeScript 5.9.3) · TypeScript on GitHub
Last reviewed 20 October 2026.