Rule reference

no-explicit-any

No explicit any

PropertyValue
TierMUST_NOT
Severityerror
EnforcementESLint (AST)
Autofixno
Skillstrict-types
Applies to**/*.ts
Exempt**/*.d.ts
Since1.0.0

Why

A test suite is the one codebase whose types are load-bearing for correctness rather than convenience: any on an API response turns a contract test into a test that the server returned something.

What to do instead

Replace any with the real type. For a response body, infer it from the Zod schema: type User = z.infer<typeof UserSchema>. When a value is genuinely unknown at the boundary, use unknown and narrow it — unknown forces the narrowing that any lets you skip.

Examples

// ✗ no-explicit-any
const body: any = await response.json();
// ✓
const body = UserSchema.parse(await response.json());