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

```ts
function maxEntries<Max extends number>(
  max: ValidateBrandFactoryCount<Max>,
): <ParentType>(
  parent: EntriesParent<`MaxEntries${Max}`, ParentType>,
) => BrandType<ParentType, `MaxEntries${Max}`, MaxEntriesError<Max>>;
```

Defined in: [packages/common/src/Type.ts:16490](https://github.com/evoluhq/evolu/blob/bc4578a260dd15d5bbf94b83765ca05984d194cb/packages/common/src/Type.ts#L16490)

Maximum entry count [Brand](https://evolu.dev/docs/api-reference/common/Brand/interfaces/Brand) for [record](https://evolu.dev/docs/api-reference/common/Type/functions/record) and [object](https://evolu.dev/docs/api-reference/common/Type/functions/object) Outputs
with at most `max` entries.

Counts entries like [minEntries](https://evolu.dev/docs/api-reference/common/Type/functions/minEntries). The count is checked after the parent
has validated every entry, so it does not limit the validation work for a
large input.

### Example

```ts
import {
  assertEqual,
  assertErr,
  assertOk,
  maxEntries,
  record,
  String,
} from "@evolu/common";

const Labels = maxEntries(2)(record(String, String));

assertOk(Labels.fromUnknown({ en: "Hello", cs: "Ahoj" }), {
  en: "Hello",
  cs: "Ahoj",
});

const value = { en: "Hello", cs: "Ahoj", de: "Hallo" };
const invalid = Labels.fromUnknown(value);
assertErr(invalid, { type: "MaxEntries2", value, max: 2 });
assertEqual(
  Labels.formatError(invalid.error),
  'The value {"en":"Hello","cs":"Ahoj","de":"Hallo"} exceeds the maximum entry count of 2.',
);
```