Is there a way in Typescript to get a union of all the types defined inside an interface?
So for example if I have an interface:
interface Events {
connect: () => void;
message: (data: object) => void;
}
I can get a union of its keys by using keyof Events
which will yield "connect" | "message"
. Is there some equivalent way of getting a union of allowed types, which would yield (() => void) | ((data: object) => void)
?