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.alphaonly letters
string.alphanumericonly letters and digits 0-9
string.base64base64-encoded
string.base64.urlbase64url-encoded
string.capitalizea morph from a string to capitalized
string.capitalize.preformattedcapitalized
string.creditCarda 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.isoan ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) date
string.date.iso.parsea morph from 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.digitsonly digits 0-9
string.emailan email address
string.integera well-formed integer string
string.integer.parsea morph from a well-formed integer string to an integer
string.ipan IP address
string.ip.v4an IPv4 address
string.ip.v6an 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 only lowercase letters
string.lower.preformattedonly 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 well-formed numeric string
string.numeric.parsea morph from a well-formed numeric string to a number
string.semvera semantic version (see https://semver.org/)
string.trima morph from a string to trimmed
string.trim.preformattedtrimmed
string.uppera morph from a string to only uppercase letters
string.upper.preformattedonly 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 UUIDv1
string.uuid.v2a UUIDv2
string.uuid.v3a UUIDv3
string.uuid.v4a UUIDv4
string.uuid.v5a UUIDv5
string.uuid.v6a UUIDv6
string.uuid.v7a UUIDv7
string.uuid.v8a 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.indexmatched 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