text
const text: TextPrimitiveText primitive with optional chainable length and pattern constraints.
Text is always escaped when serialized to JSON, so it is safe for untrusted input and
can contain arbitrary Unicode characters including newlines. In contrast, the
string primitive is intended for short single-line strings without special
characters (e.g. names, titles) and is not escaped when serialized, so it will
throw an error on the consumer side if the input contains special characters that
would break JSON syntax.
Example:
text // any texttext.min(3).max(50) // length rangetext.pattern(/^\S+@\S+\..+$/) // regex constraintThrows:
When the raw value fails this primitive’s validation.
Learn: Primitives and builders