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

```ts
function length<Exact>(
  exact: ValidateBrandFactoryNumber<Exact>,
): BrandFactory<`Length${Exact}`, ValueWithLength, LengthError<Exact>>;
```

Defined in: [packages/common/src/Type.ts:5561](https://github.com/evoluhq/evolu/blob/f0109fb501a593010e858e39248dde1200eeb2d7/packages/common/src/Type.ts#L5561)

Exact-length [Brand](https://evolu.dev/docs/api-reference/common/Brand/interfaces/Brand) for values whose `length` equals `exact`.

### Example

```ts

const ThreeCharacters = length(3)(String);
const TwoItems = length(2)(array(String));

assertOk(ThreeCharacters.fromUnknown("abc"), "abc");
assertOk(TwoItems.fromUnknown(["a", "b"]), ["a", "b"]);
```