Say I have the following type to get the common attributes between 2 objects:
type Common<T, U> = {
[K in (keyof T & keyof U) as T[K] extends U[K] ? K : never]: T[K]
}
And I want to make it so that it can accept a multiple number of objects:
type Common3<A1, A2, A3> = Common<A1, Common<A2, A3>>
type Common4<A1, A2, A3, A4> = Common<A1, Common3<A2, A3, A4>
type Common5<A1, A2, A3, A4, A5> = Common<A1, Common4<A2, A3, A4, A5>
.
.
.
Is there any way I can do this? I thought I could use variadic types but it seems like it's only for use in functions.