variable / @typed/guard/getGuard

getGuard

Returns a callable Guard unchanged or obtains one from an own callable asGuard property. Invalid adapter objects throw TypeError immediately.

Package version
1.0.0-beta.13
Category
Library adapters
Since
1.0.0

Import

import { getGuard } from "@typed/guard/getGuard";

Signatures

export declare const getGuard: <I, O, E = never, R = never>(guard: GuardInput<I, O, E, R>) => Guard<I, O, E, R>;

Why

Central normalization makes invalid adapter shapes fail at construction instead of later during Effect execution.

Ownership and lifetime

Normalization acquires no resources and returns the existing Guard function or the adapter’s result.

Examples

import { getGuard } from "@typed/guard/getGuard"
import { liftPredicate } from "@typed/guard"
const guard = getGuard(liftPredicate((value: unknown): value is string => typeof value === "string"))

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source