devtypes - v1.1.0
    Preparing search index...

    Type Alias StrictSubset<T, R, O>

    StrictSubset: RequireFrom<T, R> & ExtractFrom<T, O>

    Create a strict object subset.

    Type Parameters

    • T extends object

      Source object type

    • R extends keyof T

      Keys that must be required

    • O extends keyof T

      Keys that should be optional

    Builds a new object type consisting only of explicitly required and optional properties. All other properties are excluded.

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