• Sound mode S-01, pre-alpha
  • Design record 0007, Accepted

TSR0101

Type 'any' is not allowed in sound mode. Use 'unknown', a type parameter or a specific type.

The type 'any' is written in a sound or strict file. Use 'unknown', a type parameter or a specific type.

Rule S-01: No `any` (level: strict). Reported by ts-r-check and ts-r-lsp in files that opt in to sound mode. See Sound mode.

What it means

In sound and strict files the type any may not be written anywhere: annotations, type arguments, defaults, assertions, extends clauses and index signatures. It's reported at the any keyword. any written in .d.ts files and packages is fine; it becomes unknown where a sound file reads it (TSR0102).

Example

Spec case from design record 0007 (checked by the record's case harness, not by this site's build)
// Writing any in a variable annotation.
const raw: any = 1; // @expect TSR0101
export const copy: unknown = raw;

How to fix

  • Write unknown and narrow the value before using it.
  • Use a type parameter where the type varies: function f<T>(x: Record<string, T>).
  • Write the specific type when you know it.
  • The planned quick fix rewrites any to unknown and lets the follow-on errors guide the narrowing.

Sound mode is defined in design record 0007 (accepted 2026-10-15).