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

```ts
function endsWith<Suffix extends string>(
  suffix: Suffix & ValidateLiteral<Suffix>,
): BrandFactory<`EndsWith${Suffix}`, string, EndsWithError<Suffix>>;
```

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

String [Brand](https://evolu.dev/docs/api-reference/common/Brand/interfaces/Brand) requiring an exact, case-sensitive suffix.

Validation preserves the complete string, including the suffix. An empty
suffix accepts every string allowed by the parent Type. The suffix must be
one concrete string literal so different suffixes have distinct brands.

Like `String.prototype.endsWith`, matching compares UTF-16 code units, so a
suffix starting with a low surrogate matches the second half of a character
outside the Basic Multilingual Plane, such as an emoji.

### Example

```ts
import {
  assertEqual,
  assertErr,
  assertOk,
  assertType,
  endsWith,
  maxLength,
  String,
  type Brand,
} from "@evolu/common";

const FileName = endsWith(".json")(maxLength(64)(String));

const name = FileName.fromUnknown("config.json");
assertOk(name, "config.json");
assertType<
  typeof name.value,
  string & Brand<"MaxLength64"> & Brand<"EndsWith.json">
>();

assertEqual(FileName.to(name.value), "config.json");

assertErr(FileName.fromUnknown("config.JSON"));
assertErr(FileName.fromUnknown("X".repeat(60) + ".json"));
```