---
title: "installStmtSink(): function in IR, TypeShade API reference"
description: "installStmtSink, a function in IR. Installs the statement sink that Node.assign() writes through."
url: https://typeshade.dev/api/installstmtsink/
language: en
---

# `installStmtSink()`

Function in IR

Installs the statement sink that Node.assign() writes through.

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

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

## Syntax

```ts
const installStmtSink: (s: StmtSink) => void
```

## Parameters

**`s` `StmtSink`**

## Return value

`void`

## Description

The node module cannot import the builder (the two would import each other), so the builder registers its own `{ assign }` implementation here once, when it loads. Authoring code calls `.assign()` on a node and never calls this directly; a host that supplies its own statement builder is the only other caller.

## Examples

### Example

```ts
import { typeKey } from 'typeshade'
import { installStmtSink } from 'typeshade/core/ir'

// Record every `.assign()` instead of building a statement.
const log: string[] = []
installStmtSink({
  assign: (target, value) => {
    log.push(`${typeKey(target.type)} = ${typeKey(value.type)}`)
  },
})
```

## Source

[`src/core/ir/node.ts`, line 163](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/ir/node.ts#L163), at commit af54ddad5
