---
title: "emitStruct(): function in Emit, TypeShade API reference"
description: "emitStruct, a function in Emit. Emit one StructDecl as a WGSL struct block."
url: https://typeshade.dev/api/emitstruct/
language: en
---

# `emitStruct()`

Function in Emit

Emit one StructDecl as a WGSL struct block.

`import { emitStruct } from 'typeshade'`

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

## Syntax

```ts
const emitStruct: (s: StructDecl) => string
```

## Parameters

**`s` `StructDecl`**

## Return value

`string`

## Targets

| Target | Support | Notes |
| --- | --- | --- |
| WGSL (WebGPU) | Supported | Writes WGSL for WebGPU. |
| GLSL ES 3.00 (WebGL2) | Does not apply | |
| CPU oracle | Does not apply | |

## See also

- [`StructDecl`](https://typeshade.dev/api/structdecl-interface/)

## Source

[`src/core/backends/wgsl.ts`, line 173](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/backends/wgsl.ts#L173), at commit af54ddad5
