type-alias / @typed/guard

AnyInput

Computes the intersection of inputs accepted by an any Guard record.

Package version
1.0.0-beta.13
Category
Type utilities
Since
1.0.0

Import

import type { AnyInput } from "@typed/guard";

Signatures

export type AnyInput<GS extends Readonly<Record<string, GuardInput<any, any, any, any>>>> = UnionToIntersection<Guard.Input<GS[keyof GS]>>;

Why

Every candidate receives the same runtime value, so the input must satisfy all candidate input contracts.

Ownership and lifetime

This compile-time type acquires no resources and has no runtime lifetime.

Examples

import type { AnyInput, Guard } from "@typed/guard"
type Input = AnyInput<{ text: Guard<unknown, string>; count: Guard<unknown, number> }>

Source