Skip to content

Any Type Usage (ARCH3196)

Key typescript.quality.any-type-usage · Severity info · Category quality

The explicit any type and the non-null assertion (!) disable the TypeScript type checker, letting runtime errors slip through. Specific types, or narrowing from unknown, should be preferred.

function getName(data: any): string {
return data.user!.name;
}
interface Payload { user?: { name: string } }
function getName(data: Payload): string {
return data.user?.name ?? "anonymous";
}

Use a specific type or unknown instead of any, and narrow safely instead of using !.