typeKey()
Function in Types
The runtime twin of KeyOf: turns any ShaderType value, literal or widened, into its canonical string key.
import { typeKey } from 'typeshade'
The signature, the description and the examples come from the compiler's own source at commit 26de7be8.
Syntax
function typeKey(t: ShaderType): stringParameters
tShaderTypeThe type to spell.
Return value
string
The canonical key string.
Description
Error messages use it (SD0002, SD0004: “expected vec3typeEq compares two types by it. Every case mirrors one arm of KeyOf; if they
disagree, a value type-checks at author time but throws a spurious mismatch when the
authoring code runs, or the reverse.
Examples
Example
import { typeKey, vec3fT, texture2dArrayfT } from 'typeshade'
typeKey(vec3fT) // 'vec3<f32>'typeKey(texture2dArrayfT) // 'texture_2d_array<f32>'See also
Source
src/core/ir/types.ts, line 953, at commit 26de7be8