> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://v3.viem.sh/api/mcp` to find what you need.

# Bytes.assert

:::info
`Bytes.assert` is a re-export of ox's [`Bytes.assert`](https://oxlib.sh/api/Bytes/assert). Refer to the ox documentation for the full reference.
:::

Asserts if the given value is [`Bytes.Bytes`](/docs/utilities/bytes/types#bytes).

## Imports

```ts
import { Bytes } from 'viem/utils'
```

## Examples

```ts twoslash
// @noErrors
import { Bytes } from 'viem/utils'

Bytes.assert('abc')
// @error: Bytes.InvalidBytesTypeError:
// @error: Value `"abc"` of type `string` is an invalid Bytes value.
// @error: Bytes values must be of type `Uint8Array`.
```

## Definition

```ts
function assert(
  value: unknown,
): asserts value is Bytes
```

## Parameters

### value

* **Type:** `unknown`

Value to assert.
