ts-type-forge
    Preparing search index...

    Type Alias PartiallyRequired<T, K>

    PartiallyRequired: MergeIntersection<Omit<T, K> & Required<Pick<T, K>>>

    Creates a type where specified keys K of T are made required (removing the optional ? modifier). The resulting type is a merged intersection for better readability.

    Type Parameters

    • T

      The original type (can have optional properties).

    • K extends keyof T

      The keys to make required.

    A new type with keys K made required.

    type Data = { a?: number; b?: string; c?: boolean };
    type PartiallyRequiredData = PartiallyRequired<Data, 'a' | 'b'>;
    // Result: { a: number; b: string; c?: boolean }