I am trying to create a composite generic type created from the first argument object.
const x = {
one: (x: {a: boolean; b: boolean}) => true,
two: (x: {c: boolean; d: boolean}) => true,
};
type VVVV<t> = {
[k in keyof t]: t[k] extends (...args: any) => any ? Parameters<t[k]>[0] : {};
};
type l = VVVV<typeof x>;
type currentOutput = {
one: {
a: boolean;
b: boolean;
};
two: {
c: boolean;
d: boolean;
};
};
type desiredOutput = {
a: boolean;
b: boolean;
c: boolean;
d: boolean;
};
How do I create a type that looks like desiredOutput
from the current output of VVVV
which looks like currentOutput
?
I was looking for this :(