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

```ts
type ValidateLiteral<Expected> =
  IsUnion<Expected> extends false
    ? {} extends Readonly<Record<`${Expected}`, never>>
      ? LiteralCompileTimeError
      : Expected
    : LiteralCompileTimeError;
```

Defined in: [packages/common/src/Type.ts:3680](https://github.com/evoluhq/evolu/blob/dd96d79f1dbe9a49fa12ce8e0aa7d3d0177795ca/packages/common/src/Type.ts#L3680)

Requires one concrete literal type in a factory parameter.

Preserves an exact literal and produces a compile-time error for widened,
union, branded, or open template literal types. Use an intersection with the
inferred parameter type, as [prefixed](https://evolu.dev/docs/api-reference/common/Type/functions/prefixed) does. This guard performs no
runtime validation.

### Example

```ts

const definePrefix = <Prefix extends string>(
  prefix: Prefix & ValidateLiteral<Prefix>,
): Prefix => prefix;

const prefix = definePrefix("APP_");
assertType<typeof prefix, "APP_">();

const widened: string = "APP_";
// @ts-expect-error Expected must be one concrete literal value.
definePrefix(widened);
```