[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:4442](https://github.com/evoluhq/evolu/blob/037c390af081e9944d616ff298a729515c5c5ab7/packages/common/src/Type.ts#L4442)

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