Import
import { bindTo } from "@typed/guard";Signatures
export declare const bindTo: {
<K extends PropertyKey>(key: K): <I, O, E, R>(guard: GuardInput<I, O, E, R>) => Guard<I, {
[k in K]: O;
}, E, R>;
<I, O, E, R, K extends PropertyKey>(guard: GuardInput<I, O, E, R>, key: K): Guard<I, {
[k in K]: O;
}, E, R>;
};Why
Explicit wrapping makes arbitrary values safe for record combinators without assuming their runtime shape.
Ownership and lifetime
This pure combinator acquires no resources and creates a fresh plain object for every match.
Examples
import { bindTo, liftPredicate } from "@typed/guard"
const named = bindTo(liftPredicate(Boolean), "value")