I want to create a new type, let's say EventNames to be an union of strings. This type would be defined by extracting the event names from the EventListeners type, defined as:
export type EventListeners<T> = {
(event: 'debug', listener: (message: string) => void): T
(event: 'raw', listener: (nodeId: string, payload: unknown) => void): T
(event: 'pong', listener: (nodeId: string, ping?: number) => void): T
}
Basically, in this case, I wanted to have EventNames to be 'debug' | 'raw' | 'pong'.
Is this achievable?