[question] UnionToIntersection
Author: salisbury-espinosaCreated Aug 26, 2026Updated Aug 26, 2026
Labelsbug
Bug description
import type {UnionToIntersection} from 'type-fest';
type OneType = {
bar: string;
};
type TwoType =
| {
mode: 'foo1';
}
| {
mode: 'foo2';
};
type ResultType = UnionToIntersection<OneType | TwoType>;===> ResultType => never
Can we improve the utility so that the result becomes (ResultType = OneType & TwoType):
type ResultType =
| {
mode: 'foo1';
bar: string;
}
| {
mode: 'foo2';
bar: string;
};Repro
Source: sindresorhus/type-fest