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

TSR1304

'{0}' can throw '{1}', which '{2}' (the member it overrides or implements) does not declare.

An overriding or implementing method can throw something the member it overrides doesn't declare. Catch it, or declare it on the base.

Rule S-13: Checked exceptions (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

Code that calls a method through its base type only handles what the base declares. In sound mode an overriding or implementing method may not throw more than the member it overrides or implements declares. It's reported at the member name.

Example

Spec case from design record 0007 (checked by the record's case harness, not by this site's build)
// An override that can throw something the base method doesn't declare.
class NotFound extends Error {
  readonly code = "NOT_FOUND";
}
class Timeout extends Error {
  readonly code = "TIMEOUT";
}
class Base {
  /** @throws {NotFound} */
  get(id: string): string {
    if (id === "") throw new NotFound("missing");
    return id;
  }
}
class Remote extends Base {
  /** @throws {NotFound | Timeout} */
  override get(id: string): string { // @expect TSR1304
    if (id === "slow") throw new Timeout("slow");
    return super.get(id);
  }
}
export const v: string = new Remote().get("a");

How to fix

  • Catch the extra exception in the override.
  • Or add it to the base member's @throws tags, so every caller handles it.

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