A constructor
A string that is an email address
Extract a type intersection from a union of guards
Extract an object of types from an object of guards
Extract a type union from a union of guards
A function that performs a validation on an unknow value and returns a boolean indicating the type of the value.
A number that is an integer
Collection of interface validators
Union of types that TypeScript can narrow to literal types
A number that is negative
A number that is a negative integer
A number that is positive
A number that is a positive integer
A type tag.
A tagged type.
A function that performs a validation on an unknow value and returns a boolean.
A decorator factory that returns a decorator that turns a property into a getter/setter with a setter the asserts the value set matches the validator.
The guard/validator to assert
The name to use for the value. Defaults to the class+method name
An expection message to override the guard/validator expectation
The decorator.
Create a new guard/validator from an intersection of guards/validators
An array of guards/validators
A new intersection guard/validator
Asserts that a condition is true or throws an error if false
The condition to assert
The message to use in the thrown error. Accepts a function that can be called to generate the message to improve performance.
Asserts that the given call is never reached. Will always throw if called. Useful for ending branches that TypeScript can't properly determine
The message to throw
Asserts that a value satisfies a provided guard and is therefore of the type returned by the guard.
The guard to call with the value
The value to check
An optional name for the value to use in the error message
An optional expectation string to use in the error message. Will override the expectation string attached to the guard.
Asserts that a value satisfies a provided validator.
The validator to call with the value
The value to check
An optional name for the value to use in the error message
An optional expectation string to use in the error message. Will override the expectation string attached to the guard.
Creates a guard that tests if a value implements a specified interface
The interface name to report in the error message
The property validators (or function that returns them)
The guard
Creates a guard that tests if a value is an object with properties matching the specified property validators
An property validators (or function that returns them)
The guard
Guard that tests if the value is an any value (always true)
The value to test
true
Guard that tests if the value is an array
The value to test
The result of the test
Guard that tests if the value is an big integer
The value to test
The result of the test
Guard that tests if the value is a boolean
The value to test
The result of the test
Guard that tests if the value implements the Comparable interface
The value to test
The result of the test
Guard that tests if the value is an instance of Date
The value to test
The result of the test
Creates a guard that tests if a value is equal to the specified value using the deep-equal package
The object to compare values to
True to use strict equality (default) and false to use coercive equality
The guard
Guard that tests if the value is not null and not undefined
The value to test
The result of the test
Creates a guard that tests if a value is an array and that each value in the array satisfies the given guard.
The guard used for each item in the array.
The guard
Creates a validator that tests if a value is an array and that each value in the array satisfies the given validator.
The validator used for each item in the array.
The validator
Guard that tests if the value is an email address
The value to test
The result of the test
Guard that tests if the value is an empty array
The value to test
The result of the test
Guard that tests if the value is an empty string
The value to test
The result of the test
Creates a guard that tests if a value is equal to a specified object. Values are compared by identity first and then by using the Equatable or Comparable interfaces, if implemented.
The object to compare values to
The guard
Guard that tests if the value implements the Equatable interface
The value to test
The result of the test
Guard that tests if the value is a function
The value to test
The result of the test
Creates a guard that tests if a value is greater than a specified value. Will first compare using the Comparable interface, if implemented and will fall back to operator comparison.
The value to compare to
The guard
Creates a guard that tests if a value is greater than or equal to a specified value. Will first compare using the Comparable interface, if implemented and will fall back to operator comparison. Note that objects not implementing Comparable or custom value representations may return unexpected results as JS will revert to comparing string representations.
The value to compare to
The guard
Creates a guard that tests if a value is identical to another value. This uses the JS strict equality comparison operator (===) so primitives are compared by value but objects are compared by reference.
The other value to compare to
The guard
Creates a guard that tests if a value is an instance of the specified constructor
The constructor
The guard
Guard that tests if the value is an integer
The value to test
The result of the test
Creates a guard that tests if a value is less than a specified value. Will first compare using the Comparable interface, if implemented and will fall back to operator comparison.
The value to compare to
The guard
Creates a guard that tests if a value is less than or equal to a specified value. Will first compare using the Comparable interface, if implemented and will fall back to operator comparison. Note that objects not implementing Comparable or custom value representations may return unexpected results as JS will revert to comparing string representations.
The value to compare to
The guard
Creates a guard that tests if a value is a string that matches the specified RegExp
The regular expression
The guard
Guard that tests if the value is a negative number
The value to test
The result of the test
Guard that tests if the value is a negative integer
The value to test
The result of the test
Guard that tests if the value is null or undefined
The value to test
The result of the test
Guard that tests if the value is an array that is not empty
The value to test
The result of the test
Guard that tests if the value is a string that is not empty
The value to test
The result of the test
Guard that tests if the value is null
The value to test
The result of the test
Guard that tests if the value is a number
The value to test
The result of the test
Guard that tests if the value is any object (and not null)
The value to test
The result of the test
Guard that tests if the value is a positive number
The value to test
The result of the test
Guard that tests if the value is a positive integer
The value to test
The result of the test
Guard that tests if the value is a string
The value to test
The result of the test
Creates a guard that tests if a value is a string containing the specified substring
The substring to check for
The guard
Creates a guard that tests if a value is a string that does not contain the specified substring
The substring to check for
The guard
Guard that tests if the value is a symbol
The value to test
The result of the test
Guard that tests if the value is undefined
The value to test
The result of the test
Guard that tests if the value is an any unknown value (always true)
The value to test
true
Create a new guard/validator from a union of guards/validators
An array of guards/validators (or function that returns an array)
A new union guard/validator
Generated using TypeDoc
The result of an object comparison.