- Sound mode general, pre-alpha
- Design record 0007, Accepted
TSR0005
The '@ts-r' pragma must come before the first statement; this one is ignored.
A '// @ts-r' level pragma appears after the first statement and is ignored. Move it to the top of the file.
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
A file's level pragma is read only from the leading comments, before the first statement. A pragma further down is ignored, and this diagnostic says so.
Example
// The pragma has to come before the first statement.
export const n: number = 1;
// @ts-r off // @expect TSR0005
How to fix
- Move the pragma to the top of the file, above the imports.
Sound mode is defined in design record 0007 (accepted 2026-10-15).