`any` type
This is how the comment reads inline, under the flagged line.
Why it matters
any spreads: everything it touches stops being checked. A wrong field name or shape compiles fine and fails at runtime.
What to do
Use the real type, unknown plus a check, or a generic.
Examples
const body = (await res.json()) as any;
const body = UserSchema.parse(await res.json());
What it catches
It reads a pattern on each line, aware of strings and comments. Languages: TypeScript and JavaScript. Scope: All files. These cases are the rule's own tests: the first set must be flagged and the second must not.
Flagged
const a = b as any;
function f(x: any) {}let xs: any[] = [];
Left alone
const a = b as User;
// any value works
Research
`any`, `as unknown as`, non-null `!`, and shapeless types (`Record<string, any>`, `dict[str, Any]`). Each one turns off type checking for the values it touches.
Turn it off or change it
In a config file for the CLI, or in the API's rules field:
{
"rules": {
"disable": [
"any-type"
],
"severity": {
"any-type": "low"
}
}
}
as anyturns type checking off for this value.