Keywords

TypeScript

All

*
builtin TypeScript keywords are directly available.

const  = ({
	string: "string",
	date: "Date"
})

*
any and void are misleading and unnecessary for runtime validation and so are not included as keywords by default.

Subtype

Subtype keywords refine or transform their root type.

const  = ({
	dateFormattedString: "string.date",
	transformStringToDate: "string.date.parse",
	isoFormattedString: "string.date.iso",
	transformIsoFormattedStringToDate: "string.date.iso.parse"
})

You can easily explore available subtypes via autocomplete by with a partial definition like "string.".

All Keywords

This table includes all keywords available in default type API. To define your own string-embeddable keywords, see scopes.

string

AliasDescription
stringa string
string.alphaa string and only letters
string.alphanumerica string and only letters and digits 0-9
string.base64a string and base64-encoded
string.base64.urla string and base64url-encoded
string.capitalizea morph from a string to a string and capitalized
string.capitalize.preformatteda string and capitalized
string.creditCarda string and a credit card number and a credit card number
string.datea string and a parsable date
string.date.epochan integer string representing a safe Unix timestamp
string.date.epoch.parsea morph from an integer string representing a safe Unix timestamp to a Date
string.date.isoa string and an ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) date
string.date.iso.parsea morph from a string and an ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) date to a Date
string.date.parsea morph from a string and a parsable date to a Date
string.digitsa string and only digits 0-9
string.emaila string and an email address
string.integera string and a well-formed integer string
string.integer.parsea morph from a string and a well-formed integer string to an integer
string.ipan IP address
string.ip.v4a string and an IPv4 address
string.ip.v6a string and an IPv6 address
string.jsona string and a JSON string
string.json.parsea morph from a string to { [string]: $jsonObject | number | string | $jsonData[] | false | null | true } or $jsonData[]
string.lowera morph from a string to a string and only lowercase letters
string.lower.preformatteda string and only lowercase letters
string.normalizea morph from a string to NFC-normalized unicode
string.normalize.NFCa morph from a string to NFC-normalized unicode
string.normalize.NFC.preformattedNFC-normalized unicode
string.normalize.NFDa morph from a string to NFD-normalized unicode
string.normalize.NFD.preformattedNFD-normalized unicode
string.normalize.NFKCa morph from a string to NFKC-normalized unicode
string.normalize.NFKC.preformattedNFKC-normalized unicode
string.normalize.NFKDa morph from a string to NFKD-normalized unicode
string.normalize.NFKD.preformattedNFKD-normalized unicode
string.numerica string and a well-formed numeric string
string.numeric.parsea morph from a string and a well-formed numeric string to a number
string.semvera string and a semantic version (see https://semver.org/)
string.trima morph from a string to a string and trimmed
string.trim.preformatteda string and trimmed
string.uppera morph from a string to a string and only uppercase letters
string.upper.preformatteda string and only uppercase letters
string.urla string and a URL string
string.url.parsea morph from a string and a URL string to a URL instance
string.uuida UUID
string.uuid.v1a string and a UUIDv1
string.uuid.v2a string and a UUIDv2
string.uuid.v3a string and a UUIDv3
string.uuid.v4a string and a UUIDv4
string.uuid.v5a string and a UUIDv5
string.uuid.v6a string and a UUIDv6
string.uuid.v7a string and a UUIDv7
string.uuid.v8a string and a UUIDv8

number

AliasDescription
numbera number
number.InfinityInfinity
number.NaNNaN
number.NegativeInfinity-Infinity
number.epochan integer representing a safe Unix timestamp
number.integeran integer
number.safeat least -9007199254740991 and at most 9007199254740991

other

AliasDescription
Keya string or a symbol
biginta bigint
booleanboolean
falsefalse
nevernever
nullnull
symbola symbol
truetrue
undefinedundefined
unknownunknown
unknown.anyunknown

object

AliasDescription
objectan object
object.json{ [string]: $jsonObject | number | string | $jsonData[] | false | null | true } or $jsonData[]
object.json.stringifya morph from { [string]: $jsonObject | number | string | $jsonData[] | false | null | true } or $jsonData[] to a string

array

AliasDescription
Arrayan array
Array.indexa string and matched by ^(?:0|[1-9]\d*)$
Array.liftFroma generic type for Function
Array.readonlyan array
ArrayBufferan ArrayBuffer instance

FormData

AliasDescription
FormDataa FormData instance
FormData.parsea morph from a FormData instance to an object representing parsed form data
FormData.parsedan object representing parsed form data
FormData.valuea string or a File instance

TypedArray

AliasDescription
TypedArray.BigInt64a BigInt64Array
TypedArray.BigUint64a BigUint64Array
TypedArray.Float32a Float32Array
TypedArray.Float64a Float64Array
TypedArray.Int16an Int16Array
TypedArray.Int32an Int32Array
TypedArray.Int8an Int8Array
TypedArray.Uint16a Uint16Array
TypedArray.Uint32a Uint32Array
TypedArray.Uint8a Uint8Array
TypedArray.Uint8Clampeda Uint8ClampedArray

instanceof

AliasDescription
Bloba Blob instance
Datea Date
Erroran Error
Filea File instance
Functiona function
Headersa Headers instance
Mapa Map
Promisea Promise
RegExpa RegExp
Requesta Request instance
Responsea Response instance
Seta Set
URLa URL instance
WeakMapa WeakMap
WeakSeta WeakSet

generic

AliasDescription
Excludea generic type for Function
Extracta generic type for Function
Mergea generic type for Function
Omita generic type for Function
Partiala generic type for Function
Picka generic type for Function
Recorda generic type that instantiates an object from a single index signature and corresponding value type
Requireda generic type for Function

On this page