No implicit any types
Why it matters
Implicit any is TypeScript's escape hatch — every untyped function parameter defaults to any, which propagates through the call chain and silently disables type checking for all downstream code that touches it. ISO 25010:2011 §6.5.4 classifies this as a maintainability defect. When noImplicitAny is off, a renamed field in an API response or database schema causes zero compile-time errors and surfaces only as a runtime crash or silent data corruption in production.
Severity rationale
Critical because implicit `any` on a single function parameter can propagate silently through an entire call chain, making TypeScript's type guarantees meaningless for that code path.
Remediation
Re-enable noImplicitAny (or use strict: true) and add explicit type annotations. Use unknown when the type is genuinely unknown at compile time — never any as a shortcut — then narrow at the callsite.
// Bad: implicit any causes noImplicitAny error:
function transform(value) { return value.toString(); }
// Good: explicit type:
function transform(value: string): string { return value.toString(); }
// Good: unknown + runtime narrowing:
function parsePayload(raw: unknown): MyType {
if (!isMyType(raw)) throw new Error('Unexpected shape');
return raw;
}
Detection
-
ID:
no-implicit-any -
Severity:
critical -
What to look for: In
tsconfig.json, confirmnoImplicitAnyistrue. Note: ifstrict: trueis set,noImplicitAnyis implicitly enabled unless it is explicitly overridden withfalse. Check for"noImplicitAny": falseanywhere in the tsconfig. Also scan source files for function parameters with no type annotations — these would be the type errors this flag surfaces. Look for patterns likefunction process(data)with no: DataTypeannotation, which implicitly makesdata: any. -
Detector snippet (shell-capable tools only): If
jqis available, read the explicitcompilerOptions.noImplicitAnyvalue. Output"true"or"null"means pass IFstrict: trueis set elsewhere. Output"false"fails regardless. Exit >=2 (file not found) — fall back to prose reasoning.jq -r '.compilerOptions.noImplicitAny // "null"' tsconfig.json -
Pass criteria: Enumerate all relevant code locations.
noImplicitAnyistrue(directly or viastrict: true) and is not explicitly overridden tofalsewith at least 1 verified location. -
Fail criteria:
noImplicitAnyis explicitly set tofalse, orstrictis absent/false andnoImplicitAnyis not individually set. A partial implementation does not count as pass. -
Skip (N/A) when: Project has no TypeScript files.
-
Detail on fail:
"noImplicitAny is disabled or not set; function parameters without type annotations default to 'any'" -
Remediation: If you disabled
noImplicitAnyto silence errors during migration, re-enable it and add explicit type annotations. Useunknownwhen the type genuinely isn't known at compile time — neveranyas a shortcut:// Bad: implicit any (causes noImplicitAny error): function transform(value) { return value.toString(); } // Good: explicit type: function transform(value: string): string { return value.toString(); } // Good: when type is genuinely unknown: function parsePayload(raw: unknown): MyType { ... }
External references
- iso-25010:2011 · maintainability.modifiability — Maintainability — Modifiability
Taxons
History
- 2026-04-18·v1.0.0·Initial import from code-quality-essentials·automated
- 2026-04-20·v1.1.0·Add Phase 6.0 detect-jq snippet for deterministic tsconfig.noImplicitAny parse·by cakleinman