declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
declare type Indexify<T> = T & {
    [str: string]: undefined;
};
declare type UndefinedVals<T> = {
    [K in keyof T]: undefined;
};
declare type AllUnionKeys<T> = keyof UnionToIntersection<UndefinedVals<T>>;
declare type AllFields<T> = {
    [K in AllUnionKeys<T> & string]: Indexify<T>[K];
};
declare type A = {
    a: 'foo';
    b: string;
    c: number;
};
declare type B = {
    a: 'bar';
    b: boolean;
};
declare type Union = A | B;
declare type Result = AllFields<Union>;
/**
 * 🥳
 * type Result = {
 *   a: "foo" | "bar";
 *   b: string | boolean;
 *   c: number | undefined;
 * }
 */
declare type Test = {
    error: {
        t: 8;
    };
} | {
    t: 3;
};
declare type NoUndefinedField<T> = {
    [P in keyof T]-?: NoUndefinedField<NonNullable<T[P]>>;
};
declare let v: NoUndefinedField<Omit<AllFields<Test>, 't'>>;
//# sourceMappingURL=test.d.ts.map