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

```ts
function templateLiteral<Parts>(
  ...parts: {
    readonly [Index in string | number | symbol]: ValidateTemplateLiteralPart<
      Parts[Index]
    >;
  } & TemplateLiteralValidation<Parts>
): TemplateLiteralType<Parts>;
```

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

Template literal [Type](https://evolu.dev/docs/api-reference/common/Type/interfaces/Type) for validation.

Creates a canonical string Type from fixed strings and string-encoded Types.

Use this factory when Output should remain a string. Switch to
[templateLiteralParser](https://evolu.dev/docs/api-reference/common/Type/functions/templateLiteralParser) when the individual Type parts should be decoded
into a Tuple.

### Example

```ts
import {
  assertFalse,
  assertOk,
  assertType,
  templateLiteral,
  union,
} from "@evolu/common";

const Language = union("en", "cs");
const Region = union("US", "CZ");
const Locale = templateLiteral(Language, "-", Region);

assertType<typeof Locale.Output, "en-US" | "en-CZ" | "cs-US" | "cs-CZ">();
assertOk(Locale.fromUnknown("cs-CZ"), "cs-CZ");
assertFalse(Locale.is("fr-CZ"));
```