Rule 4.1
Chapter 4, Types Test
Every type an author writes must be a WGSL type under a TypeScript spelling, or a member of the f64 family (Rule 4.4).
The rule text and the parts under it are the compiler's own English, as the design document writes them.
Rationale
the layout, the constructors, and the builtins of a type are WGSL’s; a type WGSL does not have has none of those.
Derives from
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:
SUPPORTED_TYPE_NAMES in src/compiler/ts/type-map.ts (TS8002 UNKNOWN_TYPE names the whole list) and surface-names.test.ts for the spellings.
The files that verify it at commit 26de7be8, each at the first line that names the rule:
Error codes that enforce it
The diagnostic codes the rule names under Enforced by, or whose registry text names the rule:
-
TS8002UNKNOWN_TYPE - A type name nothing declares, said once for the file wherever it is written (a parameter, a claim, a type argument,
B<vec3<Foo>>included, an alias, animplementsclause, the base a class or an interface extends, a body no call lowers), a type the library declares for TypeScript alone (Number) where the file declares none of its name, or a type this surface does not take in a position the mapper reads (Rule 2.1).
See also
Source
The rule at commit 26de7be8:
docs/language-design.md:267(the design document)reqs/rules/RULE-0401.md(its traceability item)