OptionalEventNames<E>: {
    [K in keyof E]: E[K] extends OptionalEvent<any, any>
        ? K
        : never
}[keyof E]

Type Parameters