is it possible to do transform this DU using mappend/conditional types
type MyDU =
| {kind: 'foo'}
| {kind: 'bar'}
type Transformed = DUTransformer<MyDU>
such that we get the folllowing result
type Transformed =
| {kind: 'foo', foo: boolean}
| {kind: 'bar', bar: boolean}
Yes, because TypeScript will distribute mapped types over a union:
The type of
Transformed
is: