Import
import { let } from "@typed/guard";This public exposure is a re-export. Its import path is supported; declaration documentation is shared with the other public exposures below.
Signatures
export { let_ as let };declare const let_: {
<K extends PropertyKey, B>(key: K, value: B): <G extends GuardInput<any, any, any, any>>(guard: G & RecordOutputConstraint<NoInfer<Guard.Output<G>>> & (K extends NoInfer<Guard.Output<G> extends infer O ? (O extends unknown ? keyof O : never) : never> ? never : unknown)) => Guard<Guard.Input<G>, Guard.Output<G> & {
[k in K]: B;
}, Guard.Error<G>, Guard.Services<G>>;
<G extends GuardInput<any, any, any, any>, K extends PropertyKey, B>(guard: G & RecordOutputConstraint<NoInfer<Guard.Output<G>>>, key: Exclude<K, NoInfer<Guard.Output<G> extends infer O ? (O extends unknown ? keyof O : never) : never>>, value: B): Guard<Guard.Input<G>, Guard.Output<G> & {
[k in K]: B;
}, Guard.Error<G>, Guard.Services<G>>;
};Why
Record construction does not mutate the input and rejects existing enumerable keys; it returns an unfrozen plain object containing own enumerable string and symbol properties while dropping prototypes and non-enumerables.
Ownership and lifetime
This pure combinator acquires no resources and creates a fresh plain object for every match.
Examples
import { bindTo, let as letGuard, liftPredicate } from "@typed/guard"
const named = letGuard(bindTo(liftPredicate(Boolean), "value"), "kind", "input")