- Sound mode S-01, pre-alpha
- Design record 0007, Accepted
TSR0102
'{0}' is 'unknown' in sound mode because '{1}' declares it as 'any'. Narrow it or parse it with 'parse<T>'.
A value typed 'any' by a lib file, package or non-sound file is 'unknown' in sound mode. Narrow it or parse it with parse<T>.
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
When a sound file reads a type declared outside the sound set (lib files, .d.ts files, packages, non-sound local files), each any in it becomes unknown. Using that value as a more specific type is reported here, where tsc would report the unknown misuse, and the message names the declaration that said any. Examples are Reflect.get, the reason of Promise.prototype.catch and Array.isArray narrowing to any[].
Example
// Reflect.get returns any in lib.
function port(config: object): number {
const p: number = Reflect.get(config, "port"); // @expect TSR0102
return p;
}
export const p: number = port({ port: 80 });
How to fix
- Narrow the value with
typeof,instanceof,inor equality checks before using it. - Or validate it with
parse<T>(value)from@ts-r.dev/guard. - Annotate callback parameters as
unknown(p.catch((e: unknown) => report(e))) and narrow inside.
Sound mode is defined in design record 0007 (accepted 2026-10-15).