Type Alias CommonPropKeys<T, Options>

CommonPropKeys: IsNever<
    T,
    {
        $else: T["length"] extends 0
            ? never
            : T["length"] extends 1
                ? keyof T[0]
                : T["length"] extends 2
                    ? keyof T[0] & keyof T[1]
                    : keyof T[0] & keyof T[1] & TuplePlus.CommonPropKeys<Tail<Tail<T>>>;
        $then: Options["$never"];
    },
>

⚗️ transform 🔢 customization

Gets the common property keys of the elements in tuple T.

Type Parameters

import { type TuplePlus } from 'type-plus'

type R = TuplePlus.CommonPropKeys<[{ a: number }, { b: number }]> // never
type R = TuplePlus.CommonPropKeys<[{ a: number, c: 1 }, { b: number, c: 2 }]> // 'c'

Return type when T is never. Default to never.