[API reference](https://evolu.dev/docs/api-reference) › [@evolu/common](https://evolu.dev/docs/api-reference/common) › [Assert](https://evolu.dev/docs/api-reference/common/Assert) › assertNotUndefined

```ts
const assertNotUndefined: <T>(
  value: T,
  message?: string,
) => asserts value is T & ({} | null);
```

Defined in: [packages/common/src/Assert.ts:394](https://github.com/evoluhq/evolu/blob/037c390af081e9944d616ff298a729515c5c5ab7/packages/common/src/Assert.ts#L394)

Asserts that a value is not undefined while preserving null.

Use this when a value is logically guaranteed not to be undefined but
TypeScript cannot prove it.

### Example

```ts
import {
  assert,
  assertEqual,
  assertErr,
  assertNotUndefined,
  assertType,
  trySync,
} from "@evolu/common";

const value = null as string | null | undefined;
assertNotUndefined(value);
assertType<string | null, typeof value>();
assertEqual(value, null);
const result = trySync(() => assertNotUndefined(undefined));
assertErr(result);
assert(result.error instanceof Error, "Expected an Error.");
assertEqual(result.error.message, "Expected value not to be undefined.");
```