---
title: "StructDecl: interface in IR, TypeShade API reference"
description: "StructDecl, an interface in IR. A ModuleDecl.structs entry: a WGSL struct declaration."
url: https://typeshade.dev/api/structdecl-interface/
language: en
---

# `StructDecl`

Interface in IR

A ModuleDecl.structs entry: a WGSL struct declaration.

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

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

## Syntax

```ts
interface StructDecl {
  readonly name: string;
  readonly fields: readonly StructField[];
}
```

## Description

On GLSL it becomes a plain struct, or a flattened set of `in`/`out` globals when its fields carry `location`/`builtin` (see [`StructField`](https://typeshade.dev/api/structfield/)). Use [`uniformStruct`](https://typeshade.dev/api/uniformstruct/) or [`ioStruct`](https://typeshade.dev/api/iostruct/) to derive one together with its binding and typed field access instead of writing this shape by hand.

## Instance properties

**`name` read only `string`**

**`fields` read only `readonly StructField[]`**

## See also

- [`StructField`](https://typeshade.dev/api/structfield/)
- [`uniformStruct`](https://typeshade.dev/api/uniformstruct/)
- [`ioStruct`](https://typeshade.dev/api/iostruct/)

## Source

[`src/core/ir/nodes/struct-decl.ts`, line 63](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/ir/nodes/struct-decl.ts#L63), at commit af54ddad5
