type ExpectedToBe = (() => 'foo') & ((baz: 88) => Optional<T>);
type T = NewType<'T', string>;
type Result = UnionToIntersection<
(() => 'foo') | ((baz: 88) => Optional<NewType<'T', string>>)
>
// Result: ExpectedToBe
type Result2 = UnionToIntersection<
IsFalsy<0> | IsDeepImmutable<{ a: string; readonly b: string }>
>
// Result 2: IsFalsy<0> & IsDeepImmutable<{ a: string; readonly b: string }> => true & true => evaluates to true
As the name implies, it turns a union into an intersection