mirror of https://github.com/vuejs/core.git
chore: add passive + combinations
This commit is contained in:
parent
972a791b7e
commit
e76bcfadd8
|
@ -42,6 +42,22 @@ expectType<JSX.Element>(
|
|||
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)
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
||||
|
|
|
@ -1351,7 +1351,24 @@ export interface BaseEvents {
|
|||
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]
|
||||
|
|
Loading…
Reference in New Issue