onInputCaptureOnce={e => {
expectType<EventTarget | null>(e.target)
}}
+ onInputPassive={e => {
+ // infer correct event type
+ expectType<EventTarget | null>(e.target)
+ }}
+ onInputCapturePassive={e => {
+ expectType<EventTarget | null>(e.target)
+ }}
+ onInputOncePassive={e => {
+ expectType<EventTarget | null>(e.target)
+ }}
+ onInputOnceCapturePassive={e => {
+ expectType<EventTarget | null>(e.target)
+ }}
+ onInputPassiveCaptureOnce={e => {
+ expectType<EventTarget | null>(e.target)
+ }}
/>
)
onTransitionstart: TransitionEvent
}
-type EventModifiers = 'Capture' | 'Once' | `OnceCapture` | 'CaptureOnce'
+// All possible combinations, could be generated programmatically but
+// probably too much trouble for little gain, especially it will incur more overhead on the typing
+type EventModifiers =
+ | 'Capture'
+ | 'Once'
+ | 'Passive'
+ | 'CaptureOnce'
+ | 'OnceCapture'
+ | 'CapturePassive'
+ | 'PassiveCapture'
+ | 'OncePassive'
+ | 'PassiveOnce'
+ | 'CaptureOncePassive'
+ | 'CapturePassiveOnce'
+ | 'OnceCapturePassive'
+ | 'OncePassiveCapture'
+ | 'PassiveCaptureOnce'
+ | 'PassiveOnceCapture'
type Events = BaseEvents & {
[K in keyof BaseEvents as `${K & string}${EventModifiers}`]: BaseEvents[K]