MergeIntersections<T>
&
で結合した型を読みやすくする
単純な定義
tstype MergeIntersections<T> = Pick<T, keyof T>;
定義だけ見ると何もやってないように見えるが、実際は挙動が変わる

よりhackyな書き方
tstype MergeIntersections<T> = Omit<T, never>;
定義
tstype MergeIntersections<T> = T extends object
? { [K in keyof T]: MergeIntersections<T[K]> }
: T;
ネストなども加味する
intersectionした後の加工なので当然だが、propertyが競合してるとneverになることに注意
tstype Foo = { a: number; b: string };
type Bar = { b: number; c: boolean };
// { a: number; b: never; c: boolean; }
type A = MergeIntersections<Foo & Bar>;
MergeInsertions
という名前で定義されてるけど、
Intersectionのほうが良くない?という気がするので、タイトルはそちらにしてる
