DistributedPick | WebHare Platform SDK
WebHare Platform SDK
    Preparing search index...

    Type Alias DistributedPick<X, Y>

    DistributedPick: X extends object ? Pick<X, keyof X & Y> : never

    Applies Pick to all types in a union. Allows all keys that are present in any object in the union. Warning: You might not be able to use all keys of the union if TypeScript has narrowed the union to a specific type. Eg:

    type A = { x: number; t: "a"; a: number } | { x: number; t: "b"; b: number };
    const a: A = { t: "a", a: 1 };
    const b = pick(a, ["t", "a", "b"]); // No overload matches this call. <snip> Type '"b"' is not assignable to type '"a" | "t" | "d"'.

    Type Parameters

    Type of the supplied object

    Type of the property keys to return

    Type with only the specified keys (distributed over the union if present)