Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic DOM Events #1624

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions baselines/audioworklet.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ declare var ErrorEvent: {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event)
*/
interface Event {
interface Event<T extends EventTarget = EventTarget> {
/**
* Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise.
*
Expand Down Expand Up @@ -463,7 +463,7 @@ interface Event {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget)
*/
readonly currentTarget: EventTarget | null;
readonly currentTarget: T | null;
/**
* Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise.
*
Expand Down Expand Up @@ -499,7 +499,7 @@ interface Event {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target)
*/
readonly target: EventTarget | null;
readonly target: T | null;
/**
* Returns the event's timestamp as the number of milliseconds measured relative to the time origin.
*
Expand Down Expand Up @@ -557,12 +557,12 @@ declare var Event: {
readonly BUBBLING_PHASE: 3;
};

interface EventListener {
(evt: Event): void;
interface EventListener<T extends EventTarget = EventTarget> {
(evt: Event<T>): void;
}

interface EventListenerObject {
handleEvent(object: Event): void;
interface EventListenerObject<T extends EventTarget = EventTarget> {
handleEvent(object: Event<T>): void;
}

/**
Expand All @@ -588,7 +588,7 @@ interface EventTarget {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
*/
addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean): void;
addEventListener(type: string, callback: EventListenerOrEventListenerObject<this> | null, options?: AddEventListenerOptions | boolean): void;
/**
* Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
*
Expand All @@ -600,7 +600,7 @@ interface EventTarget {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
*/
removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void;
removeEventListener(type: string, callback: EventListenerOrEventListenerObject<this> | null, options?: EventListenerOptions | boolean): void;
}

declare var EventTarget: {
Expand Down Expand Up @@ -1402,7 +1402,7 @@ declare function registerProcessor(name: string, processorCtor: AudioWorkletProc
type AllowSharedBufferSource = ArrayBuffer | ArrayBufferView;
type BufferSource = ArrayBufferView | ArrayBuffer;
type DOMHighResTimeStamp = number;
type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
type EventListenerOrEventListenerObject<T extends EventTarget = EventTarget> = EventListener<T> | EventListenerObject<T>;
type MessageEventSource = MessagePort;
type ReadableStreamController<T> = ReadableStreamDefaultController<T> | ReadableByteStreamController;
type ReadableStreamReadResult<T> = ReadableStreamReadValueResult<T> | ReadableStreamReadDoneResult<T>;
Expand Down
40 changes: 20 additions & 20 deletions baselines/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5721,7 +5721,7 @@ declare var Comment: {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompositionEvent)
*/
interface CompositionEvent extends UIEvent {
interface CompositionEvent<T extends EventTarget = EventTarget> extends UIEvent<T> {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompositionEvent/data) */
readonly data: string;
/**
Expand Down Expand Up @@ -7462,7 +7462,7 @@ declare var DocumentType: {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DragEvent)
*/
interface DragEvent extends MouseEvent {
interface DragEvent<T extends EventTarget = EventTarget> extends MouseEvent<T> {
/**
* Returns the DataTransfer object for the event.
*
Expand Down Expand Up @@ -7982,7 +7982,7 @@ declare var ErrorEvent: {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event)
*/
interface Event {
interface Event<T extends EventTarget = EventTarget> {
/**
* Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise.
*
Expand Down Expand Up @@ -8012,7 +8012,7 @@ interface Event {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget)
*/
readonly currentTarget: EventTarget | null;
readonly currentTarget: T | null;
/**
* Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise.
*
Expand Down Expand Up @@ -8048,7 +8048,7 @@ interface Event {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target)
*/
readonly target: EventTarget | null;
readonly target: T | null;
/**
* Returns the event's timestamp as the number of milliseconds measured relative to the time origin.
*
Expand Down Expand Up @@ -8116,12 +8116,12 @@ declare var EventCounts: {
new(): EventCounts;
};

interface EventListener {
(evt: Event): void;
interface EventListener<T extends EventTarget = EventTarget> {
(evt: Event<T>): void;
}

interface EventListenerObject {
handleEvent(object: Event): void;
interface EventListenerObject<T extends EventTarget = EventTarget> {
handleEvent(object: Event<T>): void;
}

interface EventSourceEventMap {
Expand Down Expand Up @@ -8204,7 +8204,7 @@ interface EventTarget {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
*/
addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean): void;
addEventListener(type: string, callback: EventListenerOrEventListenerObject<this> | null, options?: AddEventListenerOptions | boolean): void;
/**
* Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
*
Expand All @@ -8216,7 +8216,7 @@ interface EventTarget {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
*/
removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void;
removeEventListener(type: string, callback: EventListenerOrEventListenerObject<this> | null, options?: EventListenerOptions | boolean): void;
}

declare var EventTarget: {
Expand Down Expand Up @@ -8501,7 +8501,7 @@ declare var FileSystemWritableFileStream: {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/FocusEvent)
*/
interface FocusEvent extends UIEvent {
interface FocusEvent<T extends EventTarget = EventTarget> extends UIEvent<T> {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FocusEvent/relatedTarget) */
readonly relatedTarget: EventTarget | null;
}
Expand Down Expand Up @@ -14303,7 +14303,7 @@ declare var InputDeviceInfo: {
};

/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/InputEvent) */
interface InputEvent extends UIEvent {
interface InputEvent<T extends EventTarget = EventTarget> extends UIEvent<T> {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/InputEvent/data) */
readonly data: string | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/InputEvent/dataTransfer) */
Expand Down Expand Up @@ -14385,7 +14385,7 @@ interface KHR_parallel_shader_compile {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/KeyboardEvent)
*/
interface KeyboardEvent extends UIEvent {
interface KeyboardEvent<T extends EventTarget = EventTarget> extends UIEvent<T> {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/altKey) */
readonly altKey: boolean;
/**
Expand Down Expand Up @@ -15592,7 +15592,7 @@ declare var MimeTypeArray: {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MouseEvent)
*/
interface MouseEvent extends UIEvent {
interface MouseEvent<T extends EventTarget = EventTarget> extends UIEvent<T> {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/MouseEvent/altKey) */
readonly altKey: boolean;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/MouseEvent/button) */
Expand Down Expand Up @@ -17593,7 +17593,7 @@ declare var PluginArray: {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/PointerEvent)
*/
interface PointerEvent extends MouseEvent {
interface PointerEvent<T extends EventTarget = EventTarget> extends MouseEvent<T> {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/PointerEvent/height) */
readonly height: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/PointerEvent/isPrimary) */
Expand Down Expand Up @@ -22414,7 +22414,7 @@ declare var Touch: {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TouchEvent)
*/
interface TouchEvent extends UIEvent {
interface TouchEvent<T extends EventTarget = EventTarget> extends UIEvent<T> {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TouchEvent/altKey) */
readonly altKey: boolean;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/TouchEvent/changedTouches) */
Expand Down Expand Up @@ -22562,7 +22562,7 @@ declare var TreeWalker: {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/UIEvent)
*/
interface UIEvent extends Event {
interface UIEvent<T extends EventTarget = EventTarget> extends Event<T> {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/UIEvent/detail) */
readonly detail: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/UIEvent/view) */
Expand Down Expand Up @@ -25596,7 +25596,7 @@ declare var WebTransportError: {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WheelEvent)
*/
interface WheelEvent extends MouseEvent {
interface WheelEvent<T extends EventTarget = EventTarget> extends MouseEvent<T> {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WheelEvent/deltaMode) */
readonly deltaMode: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/WheelEvent/deltaX) */
Expand Down Expand Up @@ -28041,7 +28041,7 @@ type ConstrainDouble = number | ConstrainDoubleRange;
type ConstrainULong = number | ConstrainULongRange;
type DOMHighResTimeStamp = number;
type EpochTimeStamp = number;
type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
type EventListenerOrEventListenerObject<T extends EventTarget = EventTarget> = EventListener<T> | EventListenerObject<T>;
type FileSystemWriteChunkType = BufferSource | Blob | string | WriteParams;
type Float32List = Float32Array | GLfloat[];
type FormDataEntryValue = File | string;
Expand Down
20 changes: 10 additions & 10 deletions baselines/serviceworker.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2202,7 +2202,7 @@ declare var ErrorEvent: {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event)
*/
interface Event {
interface Event<T extends EventTarget = EventTarget> {
/**
* Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise.
*
Expand Down Expand Up @@ -2232,7 +2232,7 @@ interface Event {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget)
*/
readonly currentTarget: EventTarget | null;
readonly currentTarget: T | null;
/**
* Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise.
*
Expand Down Expand Up @@ -2268,7 +2268,7 @@ interface Event {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target)
*/
readonly target: EventTarget | null;
readonly target: T | null;
/**
* Returns the event's timestamp as the number of milliseconds measured relative to the time origin.
*
Expand Down Expand Up @@ -2326,12 +2326,12 @@ declare var Event: {
readonly BUBBLING_PHASE: 3;
};

interface EventListener {
(evt: Event): void;
interface EventListener<T extends EventTarget = EventTarget> {
(evt: Event<T>): void;
}

interface EventListenerObject {
handleEvent(object: Event): void;
interface EventListenerObject<T extends EventTarget = EventTarget> {
handleEvent(object: Event<T>): void;
}

interface EventSourceEventMap {
Expand Down Expand Up @@ -2414,7 +2414,7 @@ interface EventTarget {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
*/
addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean): void;
addEventListener(type: string, callback: EventListenerOrEventListenerObject<this> | null, options?: AddEventListenerOptions | boolean): void;
/**
* Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
*
Expand All @@ -2426,7 +2426,7 @@ interface EventTarget {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
*/
removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void;
removeEventListener(type: string, callback: EventListenerOrEventListenerObject<this> | null, options?: EventListenerOptions | boolean): void;
}

declare var EventTarget: {
Expand Down Expand Up @@ -8547,7 +8547,7 @@ type CSSUnparsedSegment = string | CSSVariableReferenceValue;
type CanvasImageSource = ImageBitmap | OffscreenCanvas;
type DOMHighResTimeStamp = number;
type EpochTimeStamp = number;
type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
type EventListenerOrEventListenerObject<T extends EventTarget = EventTarget> = EventListener<T> | EventListenerObject<T>;
type FileSystemWriteChunkType = BufferSource | Blob | string | WriteParams;
type Float32List = Float32Array | GLfloat[];
type FormDataEntryValue = File | string;
Expand Down
20 changes: 10 additions & 10 deletions baselines/sharedworker.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2129,7 +2129,7 @@ declare var ErrorEvent: {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event)
*/
interface Event {
interface Event<T extends EventTarget = EventTarget> {
/**
* Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise.
*
Expand Down Expand Up @@ -2159,7 +2159,7 @@ interface Event {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget)
*/
readonly currentTarget: EventTarget | null;
readonly currentTarget: T | null;
/**
* Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise.
*
Expand Down Expand Up @@ -2195,7 +2195,7 @@ interface Event {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target)
*/
readonly target: EventTarget | null;
readonly target: T | null;
/**
* Returns the event's timestamp as the number of milliseconds measured relative to the time origin.
*
Expand Down Expand Up @@ -2253,12 +2253,12 @@ declare var Event: {
readonly BUBBLING_PHASE: 3;
};

interface EventListener {
(evt: Event): void;
interface EventListener<T extends EventTarget = EventTarget> {
(evt: Event<T>): void;
}

interface EventListenerObject {
handleEvent(object: Event): void;
interface EventListenerObject<T extends EventTarget = EventTarget> {
handleEvent(object: Event<T>): void;
}

interface EventSourceEventMap {
Expand Down Expand Up @@ -2341,7 +2341,7 @@ interface EventTarget {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
*/
addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean): void;
addEventListener(type: string, callback: EventListenerOrEventListenerObject<this> | null, options?: AddEventListenerOptions | boolean): void;
/**
* Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
*
Expand All @@ -2353,7 +2353,7 @@ interface EventTarget {
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
*/
removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void;
removeEventListener(type: string, callback: EventListenerOrEventListenerObject<this> | null, options?: EventListenerOptions | boolean): void;
}

declare var EventTarget: {
Expand Down Expand Up @@ -8556,7 +8556,7 @@ type CSSUnparsedSegment = string | CSSVariableReferenceValue;
type CanvasImageSource = ImageBitmap | OffscreenCanvas;
type DOMHighResTimeStamp = number;
type EpochTimeStamp = number;
type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
type EventListenerOrEventListenerObject<T extends EventTarget = EventTarget> = EventListener<T> | EventListenerObject<T>;
type FileSystemWriteChunkType = BufferSource | Blob | string | WriteParams;
type Float32List = Float32Array | GLfloat[];
type FormDataEntryValue = File | string;
Expand Down
Loading
Loading