Rule 3.1
Chapter 3, Textual structure and names Test
A shader file must begin with the directive "use typeshade" as its first statement.
The rule text and the parts under it are the compiler's own English, as the design document writes them.
Rationale
the directive is what tells the compiler and the language service that the file is a shader and not host code; the bundler and a host program’s tsconfig read the file’s name first, which Rule 3.8 fixes as *.shade.ts, and the directive is what they check it against.
Derives from
surface §1 and src/compiler/ts/source-file.ts.
How it is verified
Checked by a test. A test, a gate script or a CI workflow names this rule, and the traceability check fails when a file listed below stops naming it.
Where the rule says the compiler enforces it:
TS8001 MISSING_DIRECTIVE, which yields an otherwise empty result, for a file with no directive at all; TS8069 MISPLACED_DIRECTIVE on a directive after another top-level statement, another string directive included, with the rest of the file still checked (#200, proposal 0012), pinned by src/compiler/ts/directive-placement.test.ts.
The files that verify it at commit 26de7be8, each at the first line that names the rule:
Explained in
The sections of the surface document that explain this rule, at commit 26de7be8:
Error codes that enforce it
The diagnostic codes the rule names under Enforced by, or whose registry text names the rule:
See also
Source
The rule at commit 26de7be8:
docs/language-design.md:172(the design document)reqs/rules/RULE-0301.md(its traceability item)