StaticfactoryProvides access to a set of factory methods for generating reusable, parameterized type guards (e.g., for specific values or types).
Use Guard.factory to construct custom guards dynamically, such as:
StatichasChecks if an object has a given property key.
The object to check.
The property key to look for.
True if the object contains the property key.
StaticisChecks if a value is an array.
The value to check.
True if value is an array.
StaticisChecks if a value is a boolean.
The value to check.
True if value is of type boolean.
StaticisChecks if an array is empty.
The array to check.
True if the array has no elements.
StaticisChecks if a string is exactly the empty string ("").
The string to check.
True if the string is empty.
StaticisStaticisStaticisStaticisStaticisStaticisChecks if a value is a number.
The value to check.
True if value is a number.
StaticisChecks if a value is an object (excluding arrays and Nullable).
The value to check.
True if value is an object, false otherwise.
StaticisChecks if a value is a "plain" object, meaning it was created by the object
constructor or with an object literal ({}).
This guard is stricter than isObject because it excludes instances of custom classes, which isObject would otherwise identify as objects.
The value to check.
True if value is a plain object, false otherwise.
StaticisStaticisChecks if a value is a string.
The value to check.
True if value is a string.
StaticisChecks if a value is a tuple with the exact length and types, verified using the provided guard functions for each position.
The value to check.
A guard function for each element in the tuple.
True if value is a tuple matching the guard pattern.
A static utility class providing type-safe runtime type guards. These methods help with type narrowing and validation in TypeScript code.