Rule 1.8
On this page

Rule 1.8

Chapter 1, Introduction Test

A construct of the language is written in the language’s own syntax: the directive, a type of the surface, or an attribute @name or @name(…) on the declaration it marks. A construct that marks a function, its stage or its dispatch is an attribute @name or @name(…) on the function’s declaration. A construct that describes a value that flows into or out of an entry (an entry’s parameter, a field of an entry I/O struct, an entry’s result) or a binding is part of its type. A construct must not be written as a call of a function whose only role is to carry it. A construct exists only for what the author must state and the compiler cannot know or prove; an optimization the compiler can prove exact, a tuning parameter and a validation the compiler can satisfy by rewriting the program are the compiler’s work. Where the compiler chooses a tuning parameter by default, an attribute may let the author state it explicitly, as @workgroup_size([n]) does for a kernel (Rule 8.22): the default is the compiler’s choice, and the attribute is an override, never a requirement. TypeShade borrows TypeScript’s syntax and is not TypeScript: whether a TypeScript tool (tsc, a formatter, a linter, a bundler) accepts a form is not a criterion for the surface, and the tooling for the language’s own syntax is the project’s work, as it is for Vue single-file components and JSX.

The rule text and the parts under it are the compiler's own English, as the design document writes them.

Rationale

a "use typeshade" file is a program in the TypeShade language, and its own compiler and language service read it (Rule 3.1). A call of a fixed function name presents a construct as a library API. Change 0111 D1 measured the surface against a plain tsc and replaced @vertex with vertex(f); later revisions of change 0130 measured it against prettier, typescript-eslint, esbuild and Bun and proposed to infer the stage. The owner rejected both criteria on 2026-11-09. The owner decided on 2026-11-09 that an entry’s I/O stays in the type (docs/owner-decisions.md, OD-5). OD-5 also says that an object is passed with no qualifier (Rule 8.8). Rule 1.4 still holds where an ECMAScript form carries the meaning; a call whose only role is to mark its argument does not carry it. Rule 1.7 holds: the language service keeps an attribute as a form TypeScript parses, drops TypeScript’s grammar report on it, and checks its content with the compiler’s own check of that form. docs/roadmap.md’s first rule, “ordinary TypeScript first”, reads as: borrow TypeScript’s spelling for what TypeScript can say, and write the rest in the language’s own syntax.

Derives from

changes/0130-stage-attributes.md; the owner’s direction of 2026-11-09; change 0137; OD-5.

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:

review (Rule 13.1); the independent review of each proposal (changes/README.md); TS8028 ATTRIBUTE_NAME on a stage call (refuseStageCalls in src/compiler/ts/stage-call.ts), pinned in both halves by src/compiler/ts/stage-call.test.ts.

The files that verify it at commit af54ddad5, each at the first line that names the rule:

Explained in

The sections of the surface document that explain this rule, at commit af54ddad5:

Error codes that enforce it

The diagnostic codes the rule names under Enforced by, or whose registry text names the rule:

TS8028 ATTRIBUTE_NAME
A decorator or an entry form that this surface does not read: an identifier outside the attribute vocabulary (@vertex, @fragment, @compute, @builtin, @location), such as a misspelled @vertx; a WGSL attribute that the surface writes another way or does not borrow, such as a written @diagnostic(…); a stage written as a call, such as vertex(f); an entry that is written in a form that Rule 8.1 refuses, such as export default; or a decorator on a declaration or in a place that takes none (Rule 6.7). Without this code the decorated function or field would silently stop being an entry point or an I/O field.

See also

Source

The rule at commit af54ddad5:

Edit this page Report a problem