---
title: "ModuleParts: interface in Authoring, TypeShade API reference"
description: "ModuleParts, an interface in Authoring. The input shape module accepts…"
url: https://typeshade.dev/api/moduleparts/
language: en
---

# `ModuleParts`

Interface in Authoring

The input shape module accepts: a Partial<ModuleDecl> whose funcs also takes a key-named record as an alternative to the array, and whose uses derives structs, bindings and consts from declarator handles.

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

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

## Syntax

```ts
interface ModuleParts extends Omit<Partial<ModuleDecl>, 'funcs'> {
  readonly funcs?: readonly FuncDecl[] | Readonly<Record<string, FuncDecl>>;
  readonly uses?: readonly UsesHandle[];
}
```

## Description

Prefer the record `funcs` form when the module’s function names are its own variable names; an anonymous `fn(params, body)` is named by its key, with no separate `name` string to keep in sync. Prefer the array form when order matters and the functions already carry explicit names.

## Examples

### Example

```ts
export const SPRITE_MODULE: ModuleDecl = module({
  structs: [U.struct, VsOut.decl],
  bindings: [U.binding, atlasTex.binding, atlasSmp.binding],
  funcs: [vs, fs],
})
```

## Instance properties

**`funcs` optional read only `readonly FuncDecl[] | Readonly<Record<string, FuncDecl>>`**

The functions, as an array in emit order or as a record whose keys name them.

**`uses` optional read only `readonly UsesHandle[]`**

Declarator handles; the module’s structs, bindings and consts are derived from them.

## See also

- [`module`](https://typeshade.dev/api/module/)

## Source

[`src/core/ir/builder.ts`, line 900](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/ir/builder.ts#L900), at commit af54ddad5
