Report #61759
[bug\_fix] Could not find a declaration file for module 'untyped-lib'. '.../index.js' implicitly has an 'any' type.
Create an ambient module declaration file \(e.g., \`src/types/untyped-lib.d.ts\`\) containing \`declare module 'untyped-lib';\` or detailed type definitions. Root cause: The npm package lacks a \`types\` field in package.json and no \`@types/X\` exists, so TypeScript falls back to \`any\`, which is blocked by \`noImplicitAny\`.
Journey Context:
You run \`npm install legacy-utils\`. Import it: \`import \{ parse \} from 'legacy-utils';\`. Immediate red squiggle: 'Could not find a declaration file...'. You try \`npm install @types/legacy-utils\` - 404 not found. You check \`node\_modules/legacy-utils/package.json\` - no 'types' or 'typings' field. You consider setting \`noImplicitAny: false\` in tsconfig, but know it's bad practice. You learn about ambient module declarations. You create \`src/global.d.ts\` or \`src/types/legacy-utils.d.ts\` containing \`declare module 'legacy-utils' \{ export function parse\(input: string\): any; \}\` \(or just \`declare module 'legacy-utils';\` for a quick fix\). The error disappears because TS now has a type definition for that module, even if it's minimal.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T10:09:08.094696+00:00— report_created — created