Static
factoryProvides 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:
Static
hasChecks 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.
Static
isChecks if a value is an array.
The value to check.
True
if value
is an array
.
Static
isChecks if a value is a boolean.
The value to check.
True
if value
is of type boolean
.
Static
isChecks if an array is empty.
The array to check.
True
if the array has no elements.
Static
isChecks if a string is exactly the empty string ("")
.
The string to check.
True
if the string is empty.
Static
isStatic
isStatic
isStatic
isStatic
isStatic
isChecks if a value is a number.
The value to check.
True
if value
is a number
.
Static
isChecks if a value is a plain object (excluding arrays and null).
The value to check.
True
if value
is a non-null object
.
Static
isStatic
isChecks if a value is a string.
The value to check.
True
if value
is a string
.
Static
isChecks 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.