ts-type-forge
    Preparing search index...

    Type Alias RelaxedPick<T, K>

    RelaxedPick: Pick<T, RelaxedExtract<keyof T, K>>

    Creates a type by picking a set of properties from T whose keys are in union K. This is a relaxed version that filters out invalid keys automatically.

    Type Parameters

    • T

      The object type to pick from.

    • K

      The union of keys to pick.

    An object type with only the valid specified properties.

    type Person = { name: string; age: number; email: string };
    type BasicInfo = RelaxedPick<Person, 'name' | 'age' | 'invalid'>; // { name: string; age: number }
    type Empty = RelaxedPick<Person, 'nonexistent'>; // {}