Given this input:
export type Test = {
one: {
a: string;
b: string;
c: string;
};
two: {
a: string;
b: string;
d: string;
};
}
I need a generics like CombinedChildren<T>
which outputs the following type:
export type Combined = {
a?: string;
b?: string;
c?: string;
d?: string;
}
Basically, it takes the children properties and combines them, including them even if they're not present in all children.
Tried
export type KeyOfTest = Partial<Test[keyof Test]>
export type MappedKeyOfTest = Partial<{
[key in keyof Test[keyof Test]]: Test[keyof Test][key]
}>
But none output exactly what I want.