<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [rc-js-util](./rc-js-util.md) &gt; [blockScope](./rc-js-util.blockscope.md)

## blockScope() function

Any shared objects allocated in the callback will be released on return. By default, these will be released on throw too. In such event the error will be rethrown after releasing any shared objects.

Error handling can be disabled by setting the build flag `WASM_DISABLE_STACK_LIFECYCLE_TRY_CATCH`<!-- -->.

**Signature:**

```typescript
export declare function blockScope<TRet>(callback: () => TRet): TRet;
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

callback


</td><td>

() =&gt; TRet


</td><td>


</td></tr>
</tbody></table>
**Returns:**

TRet

