[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) › assert

```ts
const assert: (
  condition: unknown,
  message: string,
  options?: {
    actual?: unknown;
    cause?: unknown;
    diff?: "full";
    expected?: unknown;
    operator?: string;
    stackStartFn?: (...args: never[]) => unknown;
  },
) => asserts condition;
```

Defined in: [packages/common/src/Assert.ts:88](https://github.com/evoluhq/evolu/blob/dd96d79f1dbe9a49fa12ce8e0aa7d3d0177795ca/packages/common/src/Assert.ts#L88)

Asserts that a condition is truthy.

Throws an `AssertionError` with the provided message if the condition is
falsy, preventing invalid state from propagating and making the failure
easier to diagnose.

Use `assert` only when a more specific assertion, such as [assertTrue](https://evolu.dev/docs/api-reference/common/Assert/functions/assertTrue)
or [assertEqual](https://evolu.dev/docs/api-reference/common/Assert/functions/assertEqual), does not apply. For that reason, `assert` requires a
custom message explaining the expected condition.

Options provide structured diagnostics for custom assertions. Pass an
underlying failure as `cause` when it explains why the asserted condition
failed, and pass the custom assertion as `stackStartFn` to omit its
implementation from the stack trace.

### Example

```ts

const value: unknown = "Evolu";
assert(typeof value === "string", "Expected a string.");

assertType<typeof value, string>();
assertEqual(value, "Evolu");
```