# Function: ensureExists()

> **ensureExists**\<`T`>(`value`, `message?`): `T`

Defined in: [helpers/ensure.ts:51](https://github.com/coda/packs-sdk/blob/b2b4c9dba5ca748bdbb94481cc13b5ca3c328ef6/helpers/ensure.ts#L51)

Helper to check that a given value is defined, that is, is neither `undefined` nor `null`. If the value is `undefined` or `null`, an error will be raised at runtime.

This is typically used to inform TypeScript that you expect a given value to always exist. Calling this function refines a type that can otherwise be null or undefined.

## Type Parameters

| Type Parameter | | --- | | `T` |

## Parameters

| Parameter | Type | | --- | --- | | `value` | `T` | `null` | `undefined` | | `message?` | `string` |

## Returns

`T`
