type A = {d: Date, foo: string;}
type B = {d: Date, bar: number;}
type U = A | B;
// Type '{ d: Date; }' is not assignable to type 'U'.
// Property 'bar' is missing in type '{ d: Date; }' but required in type 'B'.
const withDate = (m: Omit<U, 'd'>): U => ({...m, d: new Date()});
type A = {d: Date, foo: string;}
type B = {d: Date, bar: number;}
type U = A | B;
// Type '{ d: Date; }' is not assignable to type 'U'.
// Property 'bar' is missing in type '{ d: Date; }' but required in type 'B'.
const withDate = (m: Omit<U, 'd'>): U => ({...m, d: new Date()});