CommonProps Documentation - v0.1.2
    Preparing search index...

    Type Alias CommonStrictProps<T, Empty>

    CommonStrictProps: T extends readonly [
        infer First,
        infer Second,
        ...(infer Rest),
    ]
        ? Rest extends readonly []
            ? CommonStrictPairs<First, Second>
            : CommonStrictProps<[CommonStrictPairs<First, Second>, ...Rest]>
        : T extends readonly [infer Only] ? Only : Empty

    Finds common properties across multiple types using strict type matching.

    Recursively processes an array of types, applying strict matching rules. Properties are included only if they exist in all types with exactly matching types.

    Type Parameters

    • T extends readonly unknown[]

      Array of types to find common properties for

    • Empty = {}

      Default type for empty arrays (default: {})

    Object type with strictly common properties

    interface Cat { name: string; type: 'cat'; legs: 4; }
    interface Dog { name: string; type: 'dog'; legs: 4; }
    interface Bird { name: string; type: 'bird'; legs: 2; }

    type Result = CommonStrictProps<[Cat, Dog, Bird]>; // { name: string }
    // 'type' excluded: 'cat' !== 'dog' !== 'bird'
    // 'legs' excluded: 4 !== 2