Validates a value against a type guard and returns it.
Applies the guard to the value: if it passes, returns the value; otherwise, throws a TypeError. When no custom
message is provided, generates a descriptive message from the guard function name (e.g., isString produces
"expected string").
Validates a value against a type guard and returns it.
Applies the guard to the value: if it passes, returns the value; otherwise, throws a
TypeError. When no custom message is provided, generates a descriptive message from the guard function name (e.g.,isStringproduces "expected string").