devtypes - v1.1.0
    Preparing search index...

    Type Alias ExtractFrom<T, K>

    ExtractFrom: Partial<Pick<T, K>>

    Extract specific properties as optional.

    Type Parameters

    • T

      Source object type

    • K extends keyof T

      Keys to extract

    Creates a new object type containing only the selected keys, all marked as optional regardless of their original required state.

    type User = { id: number; name: string; email?: string; phone?: string };
    type Contact = ExtractFrom< User, 'email' | 'phone' >;
    // { email?: string; phone?: string }