- Sound mode S-01, pre-alpha
- Design record 0007, Accepted
TSR0103
Calling a value of type 'Function' returns 'any'. Give '{0}' a function type.
A value of type 'Function' is called, which returns 'any'. Give it a real function type such as '() => unknown'.
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
Calling or constructing a value of type Function gives any, which would leak into sound code. It's reported at the call.
Example
// Calling a value of type Function returns any.
function invoke(fn: Function): unknown {
return fn(); // @expect TSR0103
}
export const r: unknown = invoke(() => 1);
How to fix
- Give the value a function type:
fn: () => unknown, or one with the real parameter and return types. - Use a type parameter if callers pass different function types.
Sound mode is defined in design record 0007 (accepted 2026-10-15).