Skip to content

Commit a88f594

Browse files
committed
Merge main
2 parents 25a2c27 + a340b80 commit a88f594

12 files changed

+910
-738
lines changed

baselines/audioworklet.generated.d.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,6 @@ interface UnderlyingSource<R = any> {
110110
type?: undefined;
111111
}
112112

113-
type EventListener = ((event: Event) => void) | { handleEvent(event: Event): void; };
114-
115113
interface AudioWorkletGlobalScope extends WorkletGlobalScope {
116114
readonly currentFrame: number;
117115
readonly currentTime: number;
@@ -235,6 +233,14 @@ declare var Event: {
235233
readonly NONE: number;
236234
};
237235

236+
interface EventListener {
237+
(evt: Event): void;
238+
}
239+
240+
interface EventListenerObject {
241+
handleEvent(object: Event): void;
242+
}
243+
238244
/** EventTarget is a DOM interface implemented by objects that can receive events and may have listeners for them. */
239245
interface EventTarget {
240246
/**
@@ -252,15 +258,15 @@ interface EventTarget {
252258
*
253259
* The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
254260
*/
255-
addEventListener(type: string, callback: EventListener | null, options?: AddEventListenerOptions | boolean): void;
261+
addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean): void;
256262
/**
257263
* 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.
258264
*/
259265
dispatchEvent(event: Event): boolean;
260266
/**
261267
* Removes the event listener in target's event listener list with the same type, callback, and options.
262268
*/
263-
removeEventListener(type: string, callback: EventListener | null, options?: EventListenerOptions | boolean): void;
269+
removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void;
264270
}
265271

266272
declare var EventTarget: {
@@ -324,9 +330,9 @@ interface MessagePort extends EventTarget {
324330
*/
325331
start(): void;
326332
addEventListener<K extends keyof MessagePortEventMap>(type: K, listener: (this: MessagePort, ev: MessagePortEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
327-
addEventListener(type: string, listener: EventListener, options?: boolean | AddEventListenerOptions): void;
333+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
328334
removeEventListener<K extends keyof MessagePortEventMap>(type: K, listener: (this: MessagePort, ev: MessagePortEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
329-
removeEventListener(type: string, listener: EventListener, options?: boolean | EventListenerOptions): void;
335+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
330336
}
331337

332338
declare var MessagePort: {
@@ -649,6 +655,7 @@ declare var sampleRate: number;
649655
declare function registerProcessor(name: string, processorCtor: AudioWorkletProcessorConstructor): void;
650656
type BufferSource = ArrayBufferView | ArrayBuffer;
651657
type DOMHighResTimeStamp = number;
658+
type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
652659
type MessageEventSource = MessagePort;
653660
type ReadableStreamController<T> = ReadableStreamDefaultController<T>;
654661
type ReadableStreamDefaultReadResult<T> = ReadableStreamDefaultReadValueResult<T> | ReadableStreamDefaultReadDoneResult;

baselines/dom.generated.d.ts

Lines changed: 453 additions & 435 deletions
Large diffs are not rendered by default.

baselines/serviceworker.generated.d.ts

Lines changed: 53 additions & 46 deletions
Large diffs are not rendered by default.

baselines/sharedworker.generated.d.ts

Lines changed: 61 additions & 54 deletions
Large diffs are not rendered by default.

baselines/webworker.generated.d.ts

Lines changed: 65 additions & 58 deletions
Large diffs are not rendered by default.

inputfiles/addedTypes.json

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,49 @@
577577
}
578578
}
579579
},
580+
// This is used in many DT libraries, via ckeditor
581+
"ClientRect": {
582+
"name": "ClientRect",
583+
"exposed": "Window",
584+
"deprecated": true,
585+
"extends": "DOMRect",
586+
"noInterfaceObject": true
587+
},
588+
/*
589+
Keeping EventListener and EventListenerObject isn't the most elegant way to handle
590+
the event listeners, but we need to keep the EventListener as an extendable interface
591+
for libraries like angular.
592+
*/
593+
"EventListener": {
594+
"name": "EventListener",
595+
"noInterfaceObject": true,
596+
"methods": {
597+
"method": {
598+
// This is a hack to add a call signature, but I think it's reasonable
599+
// as it means we don't have to add a call signatures section to the
600+
// emitter for this one case.
601+
"callable": {
602+
"overrideSignatures": [
603+
"(evt: Event): void"
604+
]
605+
}
606+
}
607+
},
608+
609+
},
610+
"EventListenerObject": {
611+
"name": "EventListenerObject",
612+
"noInterfaceObject": true,
613+
"methods": {
614+
"method": {
615+
"handleEvent": {
616+
"overrideSignatures": [
617+
"handleEvent(object: Event): void"
618+
]
619+
}
620+
}
621+
},
622+
},
580623
"Document": {
581624
"methods": {
582625
"method": {
@@ -601,6 +644,32 @@
601644
}
602645
}
603646
},
647+
// This is used in the React d.ts files, and not including
648+
// it would force an update for anyone using React.
649+
"StyleMedia": {
650+
"name": "StyleMedia",
651+
"exposed": "Window",
652+
"noInterfaceObject": true,
653+
"deprecated": true,
654+
"properties": {
655+
"property": {
656+
"type": {
657+
"name": "type",
658+
"type": "DOMString"
659+
}
660+
}
661+
},
662+
"methods": {
663+
"method": {
664+
"matchMedium": {
665+
"name": "matchMedium",
666+
"overrideSignatures": [
667+
"matchMedium(mediaquery: string): boolean"
668+
]
669+
}
670+
}
671+
}
672+
},
604673
"Navigator": {
605674
"name": "Navigator",
606675
"properties": {
@@ -1186,6 +1255,10 @@
11861255
}
11871256
],
11881257
"overrideType": "ReadableStreamDefaultReader<T>"
1258+
},
1259+
{
1260+
"name": "EventListenerOrEventListenerObject",
1261+
"overrideType": "EventListener | EventListenerObject"
11891262
}
11901263
]
11911264
}

inputfiles/knownTypes.json

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
"ComputedKeyframe",
1414
"CryptoKeyPair",
1515
"DisplayCaptureSurfaceType",
16+
"EcdhKeyDeriveParams",
17+
"EcdsaParams",
1618
"EcKeyAlgorithm",
1719
"EcKeyGenParams",
1820
"EcKeyImportParams",
19-
"EcdhKeyDeriveParams",
20-
"EcdsaParams",
21+
"EventListenerOrEventListenerObject",
2122
"HashAlgorithmIdentifier",
2223
"HkdfParams",
2324
"HmacImportParams",
@@ -30,6 +31,13 @@
3031
"NamedCurve",
3132
"Pbkdf2Params",
3233
"PropertyIndexedKeyframes",
34+
"RsaHashedImportParams",
35+
"RsaHashedKeyAlgorithm",
36+
"RsaHashedKeyGenParams",
37+
"RsaKeyAlgorithm",
38+
"RsaKeyGenParams",
39+
"RsaOaepParams",
40+
"RsaPssParams",
3341
"RTCCertificateExpiration",
3442
"RTCIceCandidatePairStats",
3543
"RTCInboundRtpStreamStats",
@@ -43,13 +51,6 @@
4351
"RTCStatsType",
4452
"RTCIceRole",
4553
"RTCTransportStats",
46-
"RsaHashedImportParams",
47-
"RsaHashedKeyAlgorithm",
48-
"RsaHashedKeyGenParams",
49-
"RsaKeyAlgorithm",
50-
"RsaKeyGenParams",
51-
"RsaOaepParams",
52-
"RsaPssParams",
5354
"Transferable",
5455
"VideoFacingModeEnum"
5556
],
@@ -67,6 +68,7 @@
6768
"EcdsaParams",
6869
"EcKeyGenParams",
6970
"EcKeyImportParams",
71+
"EventListenerOrEventListenerObject",
7072
"HashAlgorithmIdentifier",
7173
"HkdfParams",
7274
"HmacImportParams",
@@ -78,11 +80,12 @@
7880
"RsaHashedImportParams",
7981
"RsaHashedKeyGenParams",
8082
"RsaKeyGenParams",
81-
"RsaPssParams",
8283
"RsaOaepParams",
84+
"RsaPssParams",
8385
"Transferable"
8486
],
8587
"Worklet": [
88+
"EventListenerOrEventListenerObject",
8689
"Transferable"
8790
]
8891
}

inputfiles/overridingTypes.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2743,6 +2743,36 @@
27432743
}
27442744
}
27452745
},
2746+
"EventTarget": {
2747+
"methods": {
2748+
"method": {
2749+
"addEventListener": {
2750+
"signature": {
2751+
"0": {
2752+
"param": [
2753+
{
2754+
"name": "callback",
2755+
"overrideType": "EventListenerOrEventListenerObject"
2756+
}
2757+
]
2758+
}
2759+
}
2760+
},
2761+
"removeEventListener": {
2762+
"signature": {
2763+
"0": {
2764+
"param": [
2765+
{
2766+
"name": "callback",
2767+
"overrideType": "EventListenerOrEventListenerObject"
2768+
}
2769+
]
2770+
}
2771+
}
2772+
}
2773+
}
2774+
}
2775+
},
27462776
"WorkerGlobalScope": {
27472777
"properties": {
27482778
"property": {

0 commit comments

Comments
 (0)