# deserializeHeap

> **deserializeHeap**<`A`>(`value`, `order`, `options`): [`Heap`](/reference/knotkit/heap/type-aliases/heap/)<`A`>

Defined in: [packages/heap/src/serialization/binary.ts:169](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/heap/src/serialization/binary.ts#L169)

Restore a heap from canonical binary bytes after staging and validating every node. The supplied order must match the order used at construction.

## Type Parameters

### A

`A`

## Parameters

### value

`unknown`

### order

[`Order`](/reference/knotkit/heap/type-aliases/order/)<`A`>

### options

[`DeserializeHeapOptions`](/reference/knotkit/heap/wire/interfaces/deserializeheapoptions/)<`A`>

## Returns

[`Heap`](/reference/knotkit/heap/type-aliases/heap/)<`A`>

## Throws

With `MISSING_ELEMENT_CODEC` when `options.codec` is absent, which is a caller contract rather than a property of the bytes.

## Throws

For malformed bytes, unsupported versions, invalid codec results, invalid arity, heap-invariant violations, or decode-budget violations.
