---
title: "EmitFragment: interface in Emit, TypeShade API reference"
description: "EmitFragment, an interface in Emit. A module emitted without its stage wrapper, plus everything the host must supply or ensure for the result to compile."
url: https://typeshade.dev/api/emitfragment-interface/
language: en
---

# `EmitFragment`

Interface in Emit

A module emitted without its stage wrapper, plus everything the host must supply or ensure for the result to compile.

`import type { EmitFragment } from 'typeshade'`

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

## Syntax

```ts
interface EmitFragment {
  readonly source: string;
  readonly preamble: readonly string[];
  readonly declares: FragmentDeclares;
  readonly requires: readonly string[];
}
```

## Description

Produced by [`emitFragment`](https://typeshade.dev/api/emitfragment/) (WGSL) and [`emitGlslFragment`](https://typeshade.dev/api/emitglslfragment/) (GLSL).

## Instance properties

**`source` read only `string`**

The header-less source: declarations, helpers, and (unless excluded) entry points.

**`preamble` read only `readonly string[]`**

Directive and precision lines the host must place ahead of `source`, in order. They are returned as data so a composer can merge and de-duplicate them across fragments.

**`declares` read only `FragmentDeclares`**

The manifest of what `source` declares.

**`requires` read only `readonly string[]`**

Symbols the fragment references but does not define: functions declared with [`externFn`](https://typeshade.dev/api/externfn/), and variables declared with [`externVar`](https://typeshade.dev/api/externvar/), spelled for the target. A composer can check this list against what the host actually provides. Function names come from call sites that resolve to neither a module function nor a known intrinsic. Sorted and de-duplicated.

## See also

- [`emitFragment`](https://typeshade.dev/api/emitfragment/)
- [`emitGlslFragment`](https://typeshade.dev/api/emitglslfragment/)
- [`externFn`](https://typeshade.dev/api/externfn/)
- [`externVar`](https://typeshade.dev/api/externvar/)

## Source

[`src/core/fragment.ts`, line 49](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/fragment.ts#L49), at commit af54ddad5
