---
title: "UniformStruct: interface in Layout, TypeShade API reference"
description: "UniformStruct, an interface in Layout. The handle uniformStruct returns: a struct and its binding declared together."
url: https://typeshade.dev/api/uniformstruct-interface/
language: en
---

# `UniformStruct`

Interface in Layout

The handle uniformStruct returns: a struct and its binding declared together.

`import type { UniformStruct } from 'typeshade'`
`import type { UniformStruct } from 'typeshade/core/ir'`

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

## Syntax

```ts
interface UniformStruct<F extends Record<string, UniformFieldSpec>> {
  readonly struct: StructDecl;
  readonly decl: StructDecl;
  readonly type: ShaderType;
  readonly binding: BindingDecl;
  readonly node: Node;
  readonly field: { readonly [K in keyof F]: UniformFieldNode<F[K]> };
}
```

## Description

`.struct` (also spelled `.decl`) is for `module({ structs })`, `.binding` for `module({ bindings })`, and `.field` gives typed, read-only field access; uniforms are read-only in WGSL, so `.field.x.assign(...)` is a `tsc` error. `F` may include a fixed-size [`arrayOf`](https://typeshade.dev/api/arrayof/) field (a struct-element array or a plain-type array), the one field shape [`PlainStruct`](https://typeshade.dev/api/plainstruct/) cannot express.

The type is exported so that other code can accept it as a generic constraint and build on the struct’s shape `F` without re-declaring it: a host can derive a CPU-side std140 buffer writer from `u.struct`, and a helper can return `UniformStruct<{ time: ...; resolution: ... } & F>` to compose a base uniform layout with a caller’s extra fields under one type-checked struct.

## Instance properties

**`struct` read only `StructDecl`**

The struct declaration, for `module({ structs })`.

**`decl` read only `StructDecl`**

The same declaration as `struct`, under the name every other handle in this module uses, so `structs: [U.decl, VsOut.decl]` reads uniformly.

**`type` read only `ShaderType`**

The struct’s `ShaderType`.

**`binding` read only `BindingDecl`**

The binding declaration, for `module({ bindings })`.

**`node` read only `Node`**

The raw binding access node, for a hand-built `member(...)` read.

**`field` read only `{ readonly [K in keyof F]: UniformFieldNode<F[K]> }`**

Typed, read-only field access. A field declared with [`arrayOf`](https://typeshade.dev/api/arrayof/) exposes `.at(i)`.

## See also

- [`uniformStruct`](https://typeshade.dev/api/uniformstruct/)
- [`arrayOf`](https://typeshade.dev/api/arrayof/)
- [`PlainStruct`](https://typeshade.dev/api/plainstruct/)

## Source

[`src/core/sot.ts`, line 697](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/sot.ts#L697), at commit af54ddad5
