---
title: "Types, a category in the TypeShade API reference"
description: "Types in the TypeShade API reference. The type keys and type descriptors the authoring surface is typed by."
url: https://typeshade.dev/api/types/
language: en
---

# Types

85 members

The type keys and type descriptors the authoring surface is typed by.

The signature, the description and the examples come from the compiler's own source at commit af54ddad5.

**[`ALL_STORAGE_TEXTURE_FORMATS`](https://typeshade.dev/api/allstoragetextureformats/) Constant**

Every StorageTextureFormat, as a runtime value: the list a front end validates a written name against and a doc generator iterates.

**[`ArithArg`](https://typeshade.dev/api/aritharg/) Type**

The operand a binary arithmetic method accepts for a receiver of key K.

**[`ArrayElemKey`](https://typeshade.dev/api/arrayelemkey/) Type**

Element key of an array key: `array<f32,4>` → '`f32`', array<`vec3<f32>`> → '`vec3<f32>`', and never for a key that is not an array.

**[`arrayT`](https://typeshade.dev/api/arrayt/) Function**

Builds the ShaderType for an array.

**[`atomicI32T`](https://typeshade.dev/api/atomici32t/) Constant**

`atomic<i32>`: the signed twin of atomicU32T.

**[`atomicU32T`](https://typeshade.dev/api/atomicu32t/) Constant**

`atomic<u32>`: an unsigned 32-bit integer in storage memory that many invocations update at once through the atomic\* builtins.

**[`boolT`](https://typeshade.dev/api/boolt/) Constant**

The bool scalar type: the type of every comparison and logical (.and, .or) result, the required return type of a boolean-returning fn, and the type an If(/api/if/) condition is checked against when the authoring code runs.

**[`CAS_RESULT_STRUCTS`](https://typeshade.dev/api/casresultstructs/) Constant**

The struct `atomicCompareExchangeWeak` answers: the contents the location held before the call, and whether the exchange happened.

**[`casResultT`](https://typeshade.dev/api/casresultt/) Function**

The CAS\_RESULT\_STRUCTS type for one atomic element kind.

**[`CmpArg`](https://typeshade.dev/api/cmparg/) Type**

The operand a comparison method accepts for a receiver of key K: the receiver's own scalar kind, since both targets compare matching operands only, plus `f32` for an `f64` receiver, which widens before the compare.

**[`ElemKey`](https://typeshade.dev/api/elemkey/) Type**

Element key of a vector key; identity for scalars.

**[`f32T`](https://typeshade.dev/api/f32t/) Constant**

The `f32` scalar type, the DSL's default numeric type: what a bare numeric literal lifts to (lift(3) is a Node<'`f32`'>) and what most builtins return.

**[`f64T`](https://typeshade.dev/api/f64t/) Constant**

The emulated double-precision scalar type.

**[`Float64Key`](https://typeshade.dev/api/float64key/) Type**

The emulated-double keys, '`f64`' and the `f64` vectors.

**[`FloatKey`](https://typeshade.dev/api/floatkey/) Type**

The `f32`-family keys, '`f32`' and the `f32` vectors: the argument domain of the float-only component-wise builtins.

**[`i32T`](https://typeshade.dev/api/i32t/) Constant**

The `i32` scalar type, the DSL's signed-integer type: the result type of the `i32`(/api/`i32`/) cast, and the type a non-integer matchExpr scrutinee is cast to before emit, since WGSL's switch only accepts integer scrutinees.

**[`IntKey`](https://typeshade.dev/api/intkey/) Type**

The integer keys, `i32` and `u32` scalars and vectors, for the builtins whose WGSL and GLSL domain includes integers: abs, min, max and clamp.

**[`isF64`](https://typeshade.dev/api/isf64/) Function**

Narrows a ShaderType to the emulated-double scalar arm (f64T).

**[`isMat`](https://typeshade.dev/api/ismat/) Function**

Narrows a ShaderType to the { kind: 'mat' } arm.

**[`isMat64`](https://typeshade.dev/api/ismat64/) Function**

Narrows a ShaderType to an emulated-double matrix (matNxN<`f64`>, see mat2f64T), which is emitted as a struct of double-double columns.

**[`isScalar`](https://typeshade.dev/api/isscalar/) Function**

Narrows a ShaderType to the native { kind: 'scalar' } arm.

**[`isVec`](https://typeshade.dev/api/isvec/) Function**

Narrows a ShaderType to the native { kind: 'vec' } arm, whose elem is '`f32`' | '`i32`' | '`u32`'.

**[`isVec64`](https://typeshade.dev/api/isvec64/) Function**

Narrows a ShaderType to the emulated-double vector arm (vec2f64T and its 3- and 4-wide siblings).

**[`KeyOf`](https://typeshade.dev/api/keyof/) Type**

Turns a ShaderType literal into the precise string key that Node carries as its compile-time phantom: KeyOf<typeof vec3fT> resolves to '`vec3<f32>`', so a `vec2` and `vec3` operand mismatch fails tsc before the runtime SD0002 check in typeKey and typeEq would catch it.

**[`mat2f64T`](https://typeshade.dev/api/mat2f64t/) Constant**

A 2×2 emulated-double matrix, logically `mat2x2<f64>`.

**[`mat3f64T`](https://typeshade.dev/api/mat3f64t/) Constant**

A 3×3 emulated-double matrix; see mat2f64T for how it is emitted and the matrix operations available on it.

**[`mat4f64T`](https://typeshade.dev/api/mat4f64t/) Constant**

A 4×4 emulated-double matrix; see mat2f64T for how it is emitted and the matrix operations available on it.

**[`mat4x4fT`](https://typeshade.dev/api/mat4x4ft/) Constant**

A native `mat4x4<f32>`, the model-view-projection or view matrix type of a typical per-frame uniform.

**[`matT`](https://typeshade.dev/api/matt/) Function**

Any matCxR<`f32`> or matCxR<`f64`>: cols columns of rows components each, column-major as both targets are.

**[`NodeLike`](https://typeshade.dev/api/nodelike/) Type**

Anything accepted where a node is read: any node, mutable or read-only, or a JS number, which lifts to an `f32` literal.

**[`NonComposite`](https://typeshade.dev/api/noncomposite/) Type**

Maps a composite key to never and passes every other key through.

**[`READ_WRITE_STORAGE_FORMATS`](https://typeshade.dev/api/readwritestorageformats/) Constant**

The formats a device takes at read\_write access, which is the three single-channel 32-bit ones and no others (measured, as StorageTextureFormat describes).

**[`samplerComparisonT`](https://typeshade.dev/api/samplercomparisont/) Constant**

The comparison sampler `textureSampleCompare` takes: it compares a reference value against the texel and yields how much of the filter footprint passed, rather than the texel itself.

**[`samplerT`](https://typeshade.dev/api/samplert/) Constant**

The sampler resource type.

**[`Scalar`](https://typeshade.dev/api/scalar/) Type**

The four native scalar kinds: the ones WGSL and GLSL ES 3.00 both represent directly in hardware, and the set a ShaderType of kind: 'scalar' can carry.

**[`ScalarCastSource`](https://typeshade.dev/api/scalarcastsource/) Type**

The scalar keys a cast reads: every native scalar, plus the emulated double.

**[`ScalarKey`](https://typeshade.dev/api/scalarkey/) Type**

The key form of Scalar without 'bool': the set accepted wherever the DSL needs an indexable or comparable native scalar, such as array indices (.at(i, elem)), bitwise-op operands, and matchExpr or Switch scrutinees.

**[`ShaderType`](https://typeshade.dev/api/shadertype/) Type**

The runtime type descriptor for every value the DSL can represent: a plain, comparable discriminated union, so a switch (t.kind) over it is exhaustively checked by tsc at every site that must decide what to do with a shape (typeKey, wgslLayout, both backends' emit walkers).

**[`storageFormatFeature`](https://typeshade.dev/api/storageformatfeature/) Function**

The device feature a format needs before any device will store to it, or undefined when the format is core.

**[`storageTexel`](https://typeshade.dev/api/storagetexel/) Function**

The type of one texel of a storage texture, which its format's channel kind decides: a …uint format loads and stores `vec4<u32>`, a …sint format `vec4<i32>`, and every other one `vec4<f32>`.

**[`StorageTextureAccess`](https://typeshade.dev/api/storagetextureaccess/) Type**

How a shader may touch a storage texture.

**[`StorageTextureFormat`](https://typeshade.dev/api/storagetextureformat/) Type**

The texel formats a storage texture may carry, which is WebGPU's set of formats every device supports with STORAGE\_BINDING and no optional feature.

**[`storageTextureLayoutAccess`](https://typeshade.dev/api/storagetexturelayoutaccess/) Function**

What WebGPU's GPUStorageTextureBindingLayout.access calls a WGSL access mode.

**[`structT`](https://typeshade.dev/api/structt/) Function**

Builds the ShaderType for a named struct: the type you pass wherever a struct-typed value is authored (a b.var(name, structT('VsOut')) local, an fn parameter, an array element via arrayT).

**[`SwizzleKey`](https://typeshade.dev/api/swizzlekey/) Type**

The key of v.swizzle(S) for a vector key K: the element scalar when S has one character, otherwise vecN<elem> with N the length of S.

**[`TexelKey`](https://typeshade.dev/api/texelkey/) Type**

The `vec4<…>` key a texel load from texture key K yields: the loaded element is the element in the texture key, so `texture_2d`<`u32`> loads a `vec4<u32>`.

**[`texture1dfT`](https://typeshade.dev/api/texture1dft/) Constant**

A sampled float 1D texture: a row of texels addressed by one `f32`, the shape a transfer function or a colour ramp takes.

**[`texture2dArrayfT`](https://typeshade.dev/api/texture2darrayft/) Constant**

A sampled 2D array texture: one texture object with N independently addressable layers.

**[`texture2dArrayiT`](https://typeshade.dev/api/texture2darrayit/) Constant**

A signed-integer 2D array texture: the signed twin of texture2dArrayuT.

**[`texture2dArrayuT`](https://typeshade.dev/api/texture2darrayut/) Constant**

An unsigned-integer 2D array texture: texture2dArrayfT's layer model with texture2duT's exact integer texels.

**[`texture2dfT`](https://typeshade.dev/api/texture2dft/) Constant**

A sampled 2D float texture: the ordinary single-layer binding type behind `textureSample` and `textureLoad`, for colour ramps, lookup tables and atlases (resource).

**[`texture2diT`](https://typeshade.dev/api/texture2dit/) Constant**

A signed-integer 2D texture: the signed twin of texture2duT, with the same load-only contract.

**[`texture2dMsfT`](https://typeshade.dev/api/texture2dmsft/) Constant**

A multisampled 2D texture: the resolve-source binding for an MSAA render target, read one sample at a time with `textureLoad` inside a per-sample averaging loop.

**[`texture2duT`](https://typeshade.dev/api/texture2dut/) Constant**

An unsigned-integer 2D texture.

**[`texture3dfT`](https://typeshade.dev/api/texture3dft/) Constant**

A sampled float 3D texture: a volume addressed by a `vec3` coordinate, the shape a colour-grading lookup table or a density field takes.

**[`textureCubeArrayfT`](https://typeshade.dev/api/texturecubearrayft/) Constant**

An array of float cube textures: N environment maps in one binding, looked up by a `vec3` direction and a layer.

**[`textureCubefT`](https://typeshade.dev/api/texturecubeft/) Constant**

A sampled float cube texture: six faces looked up by a `vec3` Direction rather than a coordinate, the shape an environment map or a skybox takes.

**[`textureDepth2dArrayT`](https://typeshade.dev/api/texturedepth2darrayt/) Constant**

An array of 2D depth textures, the shape a cascaded shadow map takes.

**[`textureDepth2dT`](https://typeshade.dev/api/texturedepth2dt/) Constant**

A 2D depth texture, the texture a shadow map is.

**[`textureDepthCubeArrayT`](https://typeshade.dev/api/texturedepthcubearrayt/) Constant**

An array of cube depth textures: the shadow maps of N point lights in one binding.

**[`textureDepthCubeT`](https://typeshade.dev/api/texturedepthcubet/) Constant**

A cube depth texture: the shadow map of a point light, compared by the direction from the light.

**[`textureDepthMultisampled2dT`](https://typeshade.dev/api/texturedepthmultisampled2dt/) Constant**

A multisampled depth texture: the depth attachment of an MSAA render target, read one sample at a time with `textureLoad` and never sampled or compared.

**[`TextureElem`](https://typeshade.dev/api/textureelem/) Type**

The element type of a sampled texture: WGSL's `texture_2d`<T> type parameter, or GLSL ES 3.00's sampler prefix.

**[`TextureLoad2dKey`](https://typeshade.dev/api/textureload2dkey/) Type**

Every non-array texture key a texel load accepts: the three sampled elements plus the multisampled `f32` texture.

**[`TextureLoadArrayKey`](https://typeshade.dev/api/textureloadarraykey/) Type**

Every 2D array texture key a texel load accepts.

**[`typeEq`](https://typeshade.dev/api/typeeq/) Function**

Structural equality for ShaderType: two types are equal when their typeKey strings match, so a constant like boolT compares equal to a freshly built { kind: 'scalar', scalar: 'bool' } object even though they are different references.

**[`typeKey`](https://typeshade.dev/api/typekey/) Function**

The runtime twin of KeyOf: turns any ShaderType value, literal or widened, into its canonical string key.

**[`u32T`](https://typeshade.dev/api/u32t/) Constant**

The `u32` scalar type, the DSL's unsigned-integer type: counts, indices, and the compute and vertex builtins that are unsigned by spec (builtin; the vector form is builtin).

**[`vec2bT`](https://typeshade.dev/api/vec2bt/) Constant**

`vec2<bool>`: what a comparison of two `vec2` values yields, componentwise.

**[`vec2f64T`](https://typeshade.dev/api/vec2f64t/) Constant**

A 2-component emulated-double vector, logically `vec2<f64>`.

**[`vec2fT`](https://typeshade.dev/api/vec2ft/) Constant**

A native `vec2<f32>`, the most common vector type in the DSL: screen and UV coordinates and 2D positions, such as a uv: location(0, vec2fT) fragment-input field or a resolution: vec2fT uniform.

**[`vec2iT`](https://typeshade.dev/api/vec2it/) Constant**

A native `vec2<i32>`. Build a value with the `vec2i` constructor, for example a texel coordinate for `textureLoad`.

**[`vec2uT`](https://typeshade.dev/api/vec2ut/) Constant**

A native `vec2<u32>`, a 2-wide unsigned-integer field, such as a packed pick-ID varying declared location.

**[`vec3bT`](https://typeshade.dev/api/vec3bt/) Constant**

`vec3<bool>`: the componentwise comparison of two three-component vectors.

**[`vec3f64T`](https://typeshade.dev/api/vec3f64t/) Constant**

A 3-component emulated-double vector; see vec2f64T for how it is emitted and when to prefer the emulated-double family over plain vec3fT.

**[`vec3fT`](https://typeshade.dev/api/vec3ft/) Constant**

A native `vec3<f32>`, the usual carrier for a world-space position or direction, such as the p: vec3fT parameter of a signed-distance scene function.

**[`vec3iT`](https://typeshade.dev/api/vec3it/) Constant**

A native `vec3<i32>`, the signed-integer counterpart of vec3uT, a texel coordinate into an array texture, a signed grid cell.

**[`vec3uT`](https://typeshade.dev/api/vec3ut/) Constant**

A native `vec3<u32>`, chiefly the type of the compute `global_invocation_id` builtin (builtin).

**[`vec4bT`](https://typeshade.dev/api/vec4bt/) Constant**

`vec4<bool>`: the componentwise comparison of two four-component vectors.

**[`vec4f64T`](https://typeshade.dev/api/vec4f64t/) Constant**

A 4-component emulated-double vector; see vec2f64T for how it is emitted and when to prefer the emulated-double family over plain vec4fT.

**[`vec4fT`](https://typeshade.dev/api/vec4ft/) Constant**

A native `vec4<f32>`: an RGBA colour or a homogeneous clip-space position.

**[`vec4iT`](https://typeshade.dev/api/vec4it/) Constant**

A native `vec4<i32>`, completing the signed-integer vector family alongside vec2iT.

**[`vec4uT`](https://typeshade.dev/api/vec4ut/) Constant**

A native `vec4<u32>`, a 4-wide unsigned-integer resource or uniform field, such as the parameter block of a compute kernel (resource).

**[`voidT`](https://typeshade.dev/api/voidt/) Constant**

The absent-value type: the return type of an fn whose body never returns a value.

**[`WRITE_ONLY_STORAGE_FORMATS`](https://typeshade.dev/api/writeonlystorageformats/) Constant**

The formats a device takes at write and at no other access mode, which today is bgra8unorm alone.
