# cloneNode (/docs/api/functions/cloneNode)



```ts
function cloneNode<T>(ctx, node): T;
```

Defined in: [packages/core/src/ir.ts:118](https://github.com/austenstone/actio/blob/2b01e694a0f76521d8c073f3c6a2e48917d2c9d9/packages/core/src/ir.ts#L118)

Deep-clone a node, carrying its origin onto the copy. `structuredClone` drops
the external WeakMap entry, so we copy it explicitly — this is what keeps
provenance pointing at the source through fan-out (e.g. retry attempts).

## Type Parameters [#type-parameters]

### T [#t]

`T` *extends* `object`

## Parameters [#parameters]

### ctx [#ctx]

[`ParseContext`](../interfaces/ParseContext.mdx)

### node [#node]

`T`

## Returns [#returns]

`T`


## Sitemap

Browse the full documentation: [Markdown sitemap](https://austenstone.github.io/actio/sitemap.md) · [XML sitemap](https://austenstone.github.io/actio/sitemap.xml)