ConstExprDecl
Interface in Authoring
What constExpr returns: the ConstDecl itself, so it drops straight into module, carrying node, the typed reference to read the constant through at call sites.
import type { ConstExprDecl } from 'typeshade'
The signature, the description and the examples come from the compiler's own source at commit 26de7be8.
Syntax
interface ConstExprDecl<T extends ShaderType> extends ConstDecl { readonly node: ReadonlyNode<KeyOf<T>>;}Description
Reading through .node is what makes a rename or a retype of the constant a
tsc error rather than a constRef('NAME', someType) string that agrees with nothing.
node is non-enumerable: the declaration is spread, compared and serialized on its way to
the emitted module, and it stays exactly the object it was.
Instance properties
noderead onlyReadonlyNode<KeyOf<T>>The typed reference to read the constant through at call sites.
See also
Source
src/core/ir/builder.ts, line 1338, at commit 26de7be8