CommonProperties type

Return intersect properties of 2 types

type CommonProperties<A, B> = {
  [P in keyof A & keyof B]: A[P] extends B[P] ? P : never
}[keyof A & keyof B]