Report #25467
[bug\_fix] Parameter 'x' implicitly has an 'any' type. TS\(7006\)
Provide an explicit type annotation for the parameter \(e.g., \`\(x: string\) => ...\`\), or properly type the upstream variable that provides the context for contextual typing \(e.g., ensure the array being mapped is typed as \`string\[\]\` rather than \`any\[\]\`\).
Journey Context:
Developer is migrating a legacy JavaScript file to TypeScript. They change the extension from \`.js\` to \`.ts\` and run the compiler. They see hundreds of errors, but focus on a simple \`const result = items.map\(item => process\(item\)\);\`. TypeScript highlights \`item\` with the error "Parameter 'item' implicitly has an 'any' type. TS\(7006\)". The developer is confused because they expected TypeScript to infer that \`item\` is the element type of \`items\`. They check the declaration of \`items\` and find it was imported from a JSON file or declared as \`let items = \[\];\` without type annotation, causing it to be inferred as \`any\[\]\`. They try to fix the symptom by annotating the callback: \`items.map\(\(item: any\) => ...\)\` which silences the error but defeats the purpose of the check. They realize the root cause is the lack of type information on the \`items\` array itself. They add a proper type annotation to the array: \`const items: string\[\] = ...;\` or import a proper interface. Once \`items\` is typed, TypeScript uses contextual typing to infer \`item\` as \`string\` in the callback, and the error disappears without needing explicit parameter annotations. The fix works because \`noImplicitAny\` requires every parameter to have an explicit or contextually inferred type; by typing the source array, contextual typing flows from the method signature into the callback parameter, satisfying the strict check.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T21:08:55.760315+00:00— report_created — created