---
title: "PackOptions: interface in Reflection, TypeShade API"
description: "PackOptions, an interface in Reflection. Everything packModule() adds on request."
url: https://typeshade.dev/api/packoptions/
language: en
---

# `PackOptions`

Interface in Reflection

Everything packModule() adds on request.

`import type { PackOptions } from 'typeshade'`

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

## Syntax

```ts
interface PackOptions {
  readonly console?: boolean | 'never';
  readonly ir?: boolean;
  readonly emit?: EmitOptions & { readonly level?: OptLevel };
}
```

## Instance properties

**`console` optional read only `boolean | 'never'`**

Retain reachable console calls as an optional variant. `true` enables it by default; `false` leaves it off; `'never'` omits it.

**`ir` optional read only `boolean`**

Add the program as portable IR, `ir`, which the load-time emitter (`typeshade/emit`) emits again without the front end. About three times the WGSL gzipped, so on request only.

**`emit` optional read only `EmitOptions & { readonly level?: OptLevel }`**

Emit the program under other options than the defaults: the WGSL writer’s own ([`EmitOptions`](https://typeshade.dev/api/emitoptions/): `parens`, `fp64Flavor` and `plugins`) and an optimization `level`, `'O0'`, `'O1'` or `'O2'` (the default; [`OptLevel`](https://typeshade.dev/api/optlevel/) says what each runs). The manifest’s `wgsl`, its recorded variant’s `wgsl`, its `glsl` (the WebGL2 tier’s programs included) and its `bindings` are the ones those options emit: `fp64Flavor` changes the bindings too, since the `'float'` flavor binds the `_fp64` guard and the `'integer'` one binds none. `parens`, `fp64Flavor` and `plugins` reach the GLSL as they reach the WGSL; `level` is the WGSL’s alone, since the GLSL writer has no level and writes its own optimized program. The manifest records `level`, `parens` and `fp64Flavor` in its `emit`, which the load-time emitter emits the program again under. A plugin is a function, which a manifest cannot record, so `ir: true` with a plugin is a `TypeError`: the load-time emitter could not emit the program again. A word an option does not take is a `TypeError` too.

## See also

- [`EmitOptions`](https://typeshade.dev/api/emitoptions/)
- [`OptLevel`](https://typeshade.dev/api/optlevel/)

## Source

[`src/core/manifest.ts`, line 83](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/manifest.ts#L83), at commit af54ddad5
