nullableGuard<T>
Widens a guard to also accept null.
Import:
import { nullableGuard } from '@mnaoumov/typescript-lib/api-contract';Signature:
function nullableGuard(guard: ExpectedTypeGuard<T>): ExpectedTypeGuard<T | null>Parameters:
| Parameter | Type | Description |
|---|---|---|
guard |
ExpectedTypeGuard<T> | The guard to widen. |
Returns: ExpectedTypeGuard<T | null> — A guard accepting what guard accepts, or null.