---
title: "StorageBuffer: interface in Layout, TypeShade API reference"
description: "StorageBuffer, an interface in Layout. The handle storageBuffer returns: a bound runtime-length array<Element> storage buffer."
url: https://typeshade.dev/api/storagebuffer-interface/
language: en
---

# `StorageBuffer`

Interface in Layout

The handle storageBuffer returns: a bound runtime-length `array<Element>` storage buffer.

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

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

## Syntax

```ts
interface StorageBuffer<A> {
  readonly binding: BindingDecl;
  readonly node: Node;
  readonly elementDecl?: StructDecl;
  at(i: ReadonlyNode<ScalarKey> | number): A;
}
```

## Description

`.at(i)` is the element accessor. For a struct element (a [`structDecl`](https://typeshade.dev/api/structdecl/) or [`ioStruct`](https://typeshade.dev/api/iostruct/) handle) it returns the typed field proxy, `buf.at(i).p0`, with no `.of()` and no element-type argument; for a scalar element (`f32T`) it returns the element node.

## Instance properties

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

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

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

The raw binding access node for the whole array.

**`elementDecl` optional read only `StructDecl`**

The element struct’s declaration, when the element was a struct handle, so that `module({ uses: [buf] })` registers the element struct too.

## Instance methods

**`at` `(i: ReadonlyNode<ScalarKey> | number): A`**

Read element `i`: the typed field proxy for a struct element, the element node for a scalar or vector element.

## See also

- [`storageBuffer`](https://typeshade.dev/api/storagebuffer/)
- [`structDecl`](https://typeshade.dev/api/structdecl/)
- [`ioStruct`](https://typeshade.dev/api/iostruct/)

## Source

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