Type Alias CommonPropKeys<A, Options>

CommonPropKeys<A, Options>: IsNever<A, {
    $else: A extends Readonly<(infer R extends Record<KeyTypes, unknown>)[]>
        ? keyof R
        : never;
    $then: Options["$never"];
}>

⚗️ transform 🔢 customization

Gets the common keys of the record types in the array A.

Type Parameters

import { type ArrayPlus } from 'type-plus'

type R = ArrayPlus.CommonPropKeys<Array<{ a: 1 }>> // 'a'
type R = ArrayPlus.CommonPropKeys<Array<{ a: 1, b: 1 } | { a: 1, c: 1 }>> // 'a'

Return type when T is never. Default to never.