- Sound mode general, pre-alpha
- Design record 0007, Accepted
TSR0001
'@ts-r-unsafe' needs a reason: write '// @ts-r-unsafe: <why this is safe>'.
A '@ts-r-unsafe' escape hatch has no reason. Write the reason after a colon: '// @ts-r-unsafe: <why this is safe>'.
Rule general: Escape hatches, pragmas and configuration. Reported by ts-r-check and ts-r-lsp in files that opt in to sound mode. See Sound mode.
What it means
// @ts-r-unsafe is sound mode's only escape hatch: on its own line it suppresses sound-mode diagnostics (TSR codes only) that start on the next line. The reason is required, so every hatch says why the code is safe. A hatch without one suppresses nothing, so the error it was meant to hide is reported too.
Example
// A hatch must give a reason; this one suppresses nothing.
// @ts-r-unsafe // @expect TSR0001
const el = document.getElementById("app")!; // @expect TSR0301
export const tag: string = el.tagName;
How to fix
- Add the reason after a colon:
// @ts-r-unsafe: the element is in the static HTML. - Limit it to the rules you mean:
// @ts-r-unsafe S-03: <reason>. - Better, fix the underlying sound-mode error so no hatch is needed.
Sound mode is defined in design record 0007 (accepted 2026-10-15).