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

TSR0601

Method '{0}' is not compatible: parameter '{1}' of type '{2}' would receive '{3}'. Methods are checked like functions in sound mode.

A method's parameter type is narrower than the method it implements or overrides. Methods are checked like functions in sound mode: widen the parameter.

Rule S-06: Methods are checked contravariantly (level: sound). Reported by ts-r-check and ts-r-lsp in files that opt in to sound mode. See Sound mode.

What it means

TypeScript compares method parameters bivariantly, so an override can accept less than its base promises, and a caller passing the wider type breaks it. In sound mode, when the target method is declared in a sound file, its parameters are compared contravariantly, like function-typed properties under strictFunctionTypes. Methods declared in lib files, .d.ts files and non-sound packages keep TypeScript's check.

Example

Spec case from design record 0007 (checked by the record's case harness, not by this site's build)
// An override that narrows a parameter of the base method.
class Base {
  accept(v: string | number): string {
    return String(v);
  }
}
class Sub extends Base {
  override accept(v: string): string { // @expect TSR0601
    return v.toUpperCase();
  }
}
export const out: string = new Sub().accept("a");

How to fix

  • Widen the parameter to the base type and narrow inside the method with a check.
  • Or make the interface or base class generic (Handler<E extends AppEvent>), so each implementation states the type it handles.

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