Skip to content

Function.templateLiteral

github-actions[bot] edited this page Jul 8, 2026 · 29 revisions

umt / templateLiteral

Function: templateLiteral()

templateLiteral<Parts>(parts, message?): (value) => TemplateLiteralReturnType<BuildTemplateLiteral<Parts>> & StandardSchemaV1<BuildTemplateLiteral<Parts>, BuildTemplateLiteral<Parts>>

Defined in: Validate/templateLiteral/core.ts:111

Creates a validator that checks whether a value matches a template literal pattern. Each part is either a string literal that must appear verbatim or a primitive validator (string / number / boolean / bigint) that contributes a regex fragment.

Type Parameters

Parts

Parts extends readonly TemplateLiteralPart[]

Tuple describing the template parts

Parameters

parts

Parts

Tuple of literal strings and primitive validators

message?

string

Custom error message for validation failure

Returns

(value) => TemplateLiteralReturnType<BuildTemplateLiteral<Parts>> & StandardSchemaV1<BuildTemplateLiteral<Parts>, BuildTemplateLiteral<Parts>>

  • Validator function for template literal strings

API

Classes

Interfaces

Type Aliases

Variables

Functions

Clone this wiki locally