Skip to content

Commit

Permalink
Use @webref/events to detect event types (#1660)
Browse files Browse the repository at this point in the history
* Use `@webref/events` to detect event types

* fix test

* better fix

* Update src/build/utils/map.ts

Co-authored-by: Holger Jeromin <[email protected]>

---------

Co-authored-by: Holger Jeromin <[email protected]>
  • Loading branch information
saschanaz and HolgerJeromin authored Sep 5, 2024
1 parent 6d1e277 commit 8318428
Show file tree
Hide file tree
Showing 16 changed files with 158 additions and 91 deletions.
48 changes: 24 additions & 24 deletions baselines/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2543,7 +2543,7 @@ interface Animatable {
interface AnimationEventMap {
"cancel": AnimationPlaybackEvent;
"finish": AnimationPlaybackEvent;
"remove": Event;
"remove": AnimationPlaybackEvent;
}

/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation) */
Expand All @@ -2561,7 +2561,7 @@ interface Animation extends EventTarget {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/finish_event) */
onfinish: ((this: Animation, ev: AnimationPlaybackEvent) => any) | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/remove_event) */
onremove: ((this: Animation, ev: Event) => any) | null;
onremove: ((this: Animation, ev: AnimationPlaybackEvent) => any) | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/pending) */
readonly pending: boolean;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/playState) */
Expand Down Expand Up @@ -3003,7 +3003,7 @@ declare var AudioWorklet: {
};

interface AudioWorkletNodeEventMap {
"processorerror": Event;
"processorerror": ErrorEvent;
}

/**
Expand All @@ -3013,7 +3013,7 @@ interface AudioWorkletNodeEventMap {
*/
interface AudioWorkletNode extends AudioNode {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioWorkletNode/processorerror_event) */
onprocessorerror: ((this: AudioWorkletNode, ev: Event) => any) | null;
onprocessorerror: ((this: AudioWorkletNode, ev: ErrorEvent) => any) | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioWorkletNode/parameters) */
readonly parameters: AudioParamMap;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioWorkletNode/port) */
Expand Down Expand Up @@ -8818,19 +8818,19 @@ declare var FontFace: {
};

interface FontFaceSetEventMap {
"loading": Event;
"loadingdone": Event;
"loadingerror": Event;
"loading": FontFaceSetLoadEvent;
"loadingdone": FontFaceSetLoadEvent;
"loadingerror": FontFaceSetLoadEvent;
}

/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet) */
interface FontFaceSet extends EventTarget {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/loading_event) */
onloading: ((this: FontFaceSet, ev: Event) => any) | null;
onloading: ((this: FontFaceSet, ev: FontFaceSetLoadEvent) => any) | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/loadingdone_event) */
onloadingdone: ((this: FontFaceSet, ev: Event) => any) | null;
onloadingdone: ((this: FontFaceSet, ev: FontFaceSetLoadEvent) => any) | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/loadingerror_event) */
onloadingerror: ((this: FontFaceSet, ev: Event) => any) | null;
onloadingerror: ((this: FontFaceSet, ev: FontFaceSetLoadEvent) => any) | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/ready) */
readonly ready: Promise<FontFaceSet>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/status) */
Expand Down Expand Up @@ -13373,8 +13373,8 @@ declare var HTMLUnknownElement: {
};

interface HTMLVideoElementEventMap extends HTMLMediaElementEventMap {
"enterpictureinpicture": Event;
"leavepictureinpicture": Event;
"enterpictureinpicture": PictureInPictureEvent;
"leavepictureinpicture": PictureInPictureEvent;
}

/**
Expand All @@ -13392,9 +13392,9 @@ interface HTMLVideoElement extends HTMLMediaElement {
*/
height: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLVideoElement/enterpictureinpicture_event) */
onenterpictureinpicture: ((this: HTMLVideoElement, ev: Event) => any) | null;
onenterpictureinpicture: ((this: HTMLVideoElement, ev: PictureInPictureEvent) => any) | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLVideoElement/leavepictureinpicture_event) */
onleavepictureinpicture: ((this: HTMLVideoElement, ev: Event) => any) | null;
onleavepictureinpicture: ((this: HTMLVideoElement, ev: PictureInPictureEvent) => any) | null;
/** Gets or sets the playsinline of the video element. for example, On iPhone, video elements will now be allowed to play inline, and will not automatically enter fullscreen mode when playback begins. */
playsInline: boolean;
/**
Expand Down Expand Up @@ -14685,7 +14685,7 @@ declare var LockManager: {
};

interface MIDIAccessEventMap {
"statechange": Event;
"statechange": MIDIConnectionEvent;
}

/**
Expand All @@ -14697,7 +14697,7 @@ interface MIDIAccess extends EventTarget {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/MIDIAccess/inputs) */
readonly inputs: MIDIInputMap;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/MIDIAccess/statechange_event) */
onstatechange: ((this: MIDIAccess, ev: Event) => any) | null;
onstatechange: ((this: MIDIAccess, ev: MIDIConnectionEvent) => any) | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/MIDIAccess/outputs) */
readonly outputs: MIDIOutputMap;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/MIDIAccess/sysexEnabled) */
Expand Down Expand Up @@ -15208,7 +15208,7 @@ declare var MediaQueryListEvent: {

interface MediaRecorderEventMap {
"dataavailable": BlobEvent;
"error": Event;
"error": ErrorEvent;
"pause": Event;
"resume": Event;
"start": Event;
Expand All @@ -15224,7 +15224,7 @@ interface MediaRecorder extends EventTarget {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/MediaRecorder/dataavailable_event) */
ondataavailable: ((this: MediaRecorder, ev: BlobEvent) => any) | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/MediaRecorder/error_event) */
onerror: ((this: MediaRecorder, ev: Event) => any) | null;
onerror: ((this: MediaRecorder, ev: ErrorEvent) => any) | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/MediaRecorder/pause_event) */
onpause: ((this: MediaRecorder, ev: Event) => any) | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/MediaRecorder/resume_event) */
Expand Down Expand Up @@ -16977,7 +16977,7 @@ declare var PaymentMethodChangeEvent: {
};

interface PaymentRequestEventMap {
"paymentmethodchange": Event;
"paymentmethodchange": PaymentMethodChangeEvent;
"shippingaddresschange": Event;
"shippingoptionchange": Event;
}
Expand All @@ -16992,7 +16992,7 @@ interface PaymentRequest extends EventTarget {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/PaymentRequest/id) */
readonly id: string;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/PaymentRequest/paymentmethodchange_event) */
onpaymentmethodchange: ((this: PaymentRequest, ev: Event) => any) | null;
onpaymentmethodchange: ((this: PaymentRequest, ev: PaymentMethodChangeEvent) => any) | null;
/**
* @deprecated
*
Expand Down Expand Up @@ -17987,7 +17987,7 @@ interface RTCDataChannelEventMap {
"bufferedamountlow": Event;
"close": Event;
"closing": Event;
"error": Event;
"error": RTCErrorEvent;
"message": MessageEvent;
"open": Event;
}
Expand Down Expand Up @@ -18017,7 +18017,7 @@ interface RTCDataChannel extends EventTarget {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/RTCDataChannel/closing_event) */
onclosing: ((this: RTCDataChannel, ev: Event) => any) | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/RTCDataChannel/error_event) */
onerror: ((this: RTCDataChannel, ev: Event) => any) | null;
onerror: ((this: RTCDataChannel, ev: RTCErrorEvent) => any) | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/RTCDataChannel/message_event) */
onmessage: ((this: RTCDataChannel, ev: MessageEvent) => any) | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/RTCDataChannel/open_event) */
Expand Down Expand Up @@ -18058,7 +18058,7 @@ declare var RTCDataChannelEvent: {
};

interface RTCDtlsTransportEventMap {
"error": Event;
"error": RTCErrorEvent;
"statechange": Event;
}

Expand All @@ -18067,7 +18067,7 @@ interface RTCDtlsTransport extends EventTarget {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/RTCDtlsTransport/iceTransport) */
readonly iceTransport: RTCIceTransport;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/RTCDtlsTransport/error_event) */
onerror: ((this: RTCDtlsTransport, ev: Event) => any) | null;
onerror: ((this: RTCDtlsTransport, ev: RTCErrorEvent) => any) | null;
onstatechange: ((this: RTCDtlsTransport, ev: Event) => any) | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/RTCDtlsTransport/state) */
readonly state: RTCDtlsTransportState;
Expand Down
12 changes: 6 additions & 6 deletions baselines/serviceworker.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2716,19 +2716,19 @@ declare var FontFace: {
};

interface FontFaceSetEventMap {
"loading": Event;
"loadingdone": Event;
"loadingerror": Event;
"loading": FontFaceSetLoadEvent;
"loadingdone": FontFaceSetLoadEvent;
"loadingerror": FontFaceSetLoadEvent;
}

/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet) */
interface FontFaceSet extends EventTarget {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/loading_event) */
onloading: ((this: FontFaceSet, ev: Event) => any) | null;
onloading: ((this: FontFaceSet, ev: FontFaceSetLoadEvent) => any) | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/loadingdone_event) */
onloadingdone: ((this: FontFaceSet, ev: Event) => any) | null;
onloadingdone: ((this: FontFaceSet, ev: FontFaceSetLoadEvent) => any) | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/loadingerror_event) */
onloadingerror: ((this: FontFaceSet, ev: Event) => any) | null;
onloadingerror: ((this: FontFaceSet, ev: FontFaceSetLoadEvent) => any) | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/ready) */
readonly ready: Promise<FontFaceSet>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/status) */
Expand Down
12 changes: 6 additions & 6 deletions baselines/sharedworker.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2605,19 +2605,19 @@ declare var FontFace: {
};

interface FontFaceSetEventMap {
"loading": Event;
"loadingdone": Event;
"loadingerror": Event;
"loading": FontFaceSetLoadEvent;
"loadingdone": FontFaceSetLoadEvent;
"loadingerror": FontFaceSetLoadEvent;
}

/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet) */
interface FontFaceSet extends EventTarget {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/loading_event) */
onloading: ((this: FontFaceSet, ev: Event) => any) | null;
onloading: ((this: FontFaceSet, ev: FontFaceSetLoadEvent) => any) | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/loadingdone_event) */
onloadingdone: ((this: FontFaceSet, ev: Event) => any) | null;
onloadingdone: ((this: FontFaceSet, ev: FontFaceSetLoadEvent) => any) | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/loadingerror_event) */
onloadingerror: ((this: FontFaceSet, ev: Event) => any) | null;
onloadingerror: ((this: FontFaceSet, ev: FontFaceSetLoadEvent) => any) | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/ready) */
readonly ready: Promise<FontFaceSet>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/status) */
Expand Down
Loading

0 comments on commit 8318428

Please sign in to comment.