redline
MediumType safetyloose-object-type

Shapeless object type

Shapeless object type. Record<string, any> says 'some object'. The fields inside aren't checked.

This is how the comment reads inline, under the flagged line.

Why it matters

Bags of Record<string, unknown> or dict[str, Any] move type errors from compile time to runtime and hide the real shape from readers.

What to do

Write the type: an interface, a TypedDict or dataclass, or a schema.

Examples

Flagged
def load() -> dict[str, Any]: ...
Better
class Order(TypedDict):
    id: str
    total: int

What it catches

It reads a pattern on each line, aware of strings and comments. Languages: TypeScript and JavaScript, Python. Scope: All files. These cases are the rule's own tests: the first set must be flagged and the second must not.

Flagged

function f(o: Record<string, any>) {}
src/app.py
def f(x: Any) -> Any:
    return x

Left alone

function f(o: Order) {}

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": [
      "loose-object-type"
    ],
    "severity": {
      "loose-object-type": "low"
    }
  }
}

Read the source or report a false positive.