---
title: "structT(): function in Types, TypeShade API reference"
description: "structT, a function in Types. Builds the ShaderType for a named struct: the type you pass wherever a struct-typed value is authored (a b.var(name…"
url: https://typeshade.dev/api/structt/
language: en
---

# `structT()`

Function in Types

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).

`import { structT } from 'typeshade/core/ir'`

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

## Syntax

```ts
const structT: <N extends string>(
  name: N,
) => { readonly kind: "struct"; readonly name: N; }
```

## Parameters

**`name` `N extends string`**

The struct’s declared name; it becomes the type’s key, `struct:<name>`.

## Return value

`{ readonly kind: 'struct'; readonly name: N }`

A `{ kind: 'struct', name }` descriptor whose `name` keeps its literal type.

## Description

Two calls with the same `name` compare equal under [`typeKey`](https://typeshade.dev/api/typekey/) and [`typeEq`](https://typeshade.dev/api/typeeq/) regardless of identity, since the key is the name string alone; the field list is never compared here. Prefer the higher-level [`ioStruct`](https://typeshade.dev/api/iostruct/) and [`uniformStruct`](https://typeshade.dev/api/uniformstruct/) declarators for new code, which return a typed accessor built on top of this; call `structT` directly when you already have a [`StructDecl`](https://typeshade.dev/api/structdecl-interface/) and need its bare `ShaderType`.

## Examples

### Example

```ts
import { typeEq } from 'typeshade'
import { structT } from 'typeshade/core/ir'

// Equality is by name only.
typeEq(structT('DF64Vec2'), structT('DF64Vec2')) // true
```

## See also

- [`arrayT`](https://typeshade.dev/api/arrayt/)
- [`typeKey`](https://typeshade.dev/api/typekey/)
- [`typeEq`](https://typeshade.dev/api/typeeq/)
- [`ioStruct`](https://typeshade.dev/api/iostruct/)
- [`uniformStruct`](https://typeshade.dev/api/uniformstruct/)
- [`StructDecl`](https://typeshade.dev/api/structdecl-interface/)

## Source

[`src/core/ir/types/composite-types.ts`, line 26](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/ir/types/composite-types.ts#L26), at commit af54ddad5
