Skip to content

Commit 43b7dd3

Browse files
saschanazsandersn
authored andcommitted
General type updates (#762)
* Support new constructor() syntax * General type updates
1 parent 4d745be commit 43b7dd3

21 files changed

+332
-204
lines changed

baselines/dom.generated.d.ts

Lines changed: 26 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1674,6 +1674,13 @@ interface ShadowRootInit {
16741674
mode: ShadowRootMode;
16751675
}
16761676

1677+
interface StaticRangeInit {
1678+
endContainer: Node;
1679+
endOffset: number;
1680+
startContainer: Node;
1681+
startOffset: number;
1682+
}
1683+
16771684
interface StereoPannerOptions extends AudioNodeOptions {
16781685
pan?: number;
16791686
}
@@ -2140,8 +2147,8 @@ interface AudioBuffer {
21402147
readonly length: number;
21412148
readonly numberOfChannels: number;
21422149
readonly sampleRate: number;
2143-
copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void;
2144-
copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void;
2150+
copyFromChannel(destination: Float32Array, channelNumber: number, bufferOffset?: number): void;
2151+
copyToChannel(source: Float32Array, channelNumber: number, bufferOffset?: number): void;
21452152
getChannelData(channel: number): Float32Array;
21462153
}
21472154

@@ -2509,7 +2516,10 @@ declare var BiquadFilterNode: {
25092516
interface Blob {
25102517
readonly size: number;
25112518
readonly type: string;
2519+
arrayBuffer(): Promise<ArrayBuffer>;
25122520
slice(start?: number, end?: number, contentType?: string): Blob;
2521+
stream(): ReadableStream;
2522+
text(): Promise<string>;
25132523
}
25142524

25152525
declare var Blob: {
@@ -3150,7 +3160,8 @@ interface CSSStyleDeclaration {
31503160
webkitBoxFlex: string;
31513161
/** @deprecated */
31523162
webkitBoxOrdinalGroup: string;
3153-
webkitBoxOrient: string | null;
3163+
/** @deprecated */
3164+
webkitBoxOrient: string;
31543165
/** @deprecated */
31553166
webkitBoxPack: string;
31563167
/** @deprecated */
@@ -3817,7 +3828,7 @@ declare var CryptoKeyPair: {
38173828
};
38183829

38193830
interface CustomElementRegistry {
3820-
define(name: string, constructor: Function, options?: ElementDefinitionOptions): void;
3831+
define(name: string, constructor: CustomElementConstructor, options?: ElementDefinitionOptions): void;
38213832
get(name: string): any;
38223833
upgrade(root: Node): void;
38233834
whenDefined(name: string): Promise<void>;
@@ -4504,10 +4515,6 @@ interface Document extends Node, DocumentAndElementEventHandlers, DocumentOrShad
45044515
* Sets or gets the URL for the current document.
45054516
*/
45064517
readonly URL: string;
4507-
/**
4508-
* Gets the object that has the focus when the parent document has focus.
4509-
*/
4510-
readonly activeElement: Element | null;
45114518
/**
45124519
* Sets or gets the color of all active links in the document.
45134520
*/
@@ -5508,7 +5515,7 @@ interface EventTarget {
55085515
*
55095516
* When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
55105517
*
5511-
* When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in §2.8 Observing event listeners.
5518+
* When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
55125519
*
55135520
* When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
55145521
*
@@ -5813,7 +5820,6 @@ interface GlobalEventHandlersEventMap {
58135820
"load": Event;
58145821
"loadeddata": Event;
58155822
"loadedmetadata": Event;
5816-
"loadend": ProgressEvent;
58175823
"loadstart": Event;
58185824
"lostpointercapture": PointerEvent;
58195825
"mousedown": MouseEvent;
@@ -5998,7 +6004,6 @@ interface GlobalEventHandlers {
59986004
* @param ev The event.
59996005
*/
60006006
onloadedmetadata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
6001-
onloadend: ((this: GlobalEventHandlers, ev: ProgressEvent) => any) | null;
60026007
/**
60036008
* Occurs when Internet Explorer begins looking for media data.
60046009
* @param ev The event.
@@ -6420,10 +6425,6 @@ declare var HTMLBodyElement: {
64206425

64216426
/** Provides properties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating <button> elements. */
64226427
interface HTMLButtonElement extends HTMLElement {
6423-
/**
6424-
* Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing.
6425-
*/
6426-
autofocus: boolean;
64276428
disabled: boolean;
64286429
/**
64296430
* Retrieves a reference to the form that the object is embedded in.
@@ -7270,10 +7271,6 @@ interface HTMLInputElement extends HTMLElement {
72707271
* Specifies whether autocomplete is applied to an editable text field.
72717272
*/
72727273
autocomplete: string;
7273-
/**
7274-
* Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing.
7275-
*/
7276-
autofocus: boolean;
72777274
/**
72787275
* Sets or retrieves the state of the check box or radio button.
72797276
*/
@@ -8159,6 +8156,7 @@ declare var HTMLOptionsCollection: {
81598156
};
81608157

81618158
interface HTMLOrSVGElement {
8159+
autofocus: boolean;
81628160
readonly dataset: DOMStringMap;
81638161
nonce?: string;
81648162
tabIndex: number;
@@ -8367,10 +8365,6 @@ declare var HTMLScriptElement: {
83678365
/** A <select> HTML Element. These elements also share all of the properties and methods of other HTML elements via the HTMLElement interface. */
83688366
interface HTMLSelectElement extends HTMLElement {
83698367
autocomplete: string;
8370-
/**
8371-
* Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing.
8372-
*/
8373-
autofocus: boolean;
83748368
disabled: boolean;
83758369
/**
83768370
* Retrieves a reference to the form that the object is embedded in.
@@ -8907,10 +8901,6 @@ declare var HTMLTemplateElement: {
89078901
/** Provides special properties and methods for manipulating the layout and presentation of <textarea> elements. */
89088902
interface HTMLTextAreaElement extends HTMLElement {
89098903
autocomplete: string;
8910-
/**
8911-
* Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing.
8912-
*/
8913-
autofocus: boolean;
89148904
/**
89158905
* Sets or retrieves the width of the object.
89168906
*/
@@ -15455,7 +15445,7 @@ interface StaticRange extends AbstractRange {
1545515445

1545615446
declare var StaticRange: {
1545715447
prototype: StaticRange;
15458-
new(): StaticRange;
15448+
new(init: StaticRangeInit): StaticRange;
1545915449
};
1546015450

1546115451
/** The pan property takes a unitless value between -1 (full left pan) and 1 (full right pan). This interface was introduced as a much simpler way to apply a simple panning effect than having to use a full PannerNode. */
@@ -18536,7 +18526,7 @@ interface WindowEventMap extends GlobalEventHandlersEventMap, WindowEventHandler
1853618526
}
1853718527

1853818528
/** A window containing a DOM document; the document property points to the DOM document loaded in that window. */
18539-
interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandlers, IDBEnvironment, WindowBase64, WindowConsole, WindowEventHandlers, WindowLocalStorage, WindowOrWorkerGlobalScope, WindowSessionStorage, WindowTimers {
18529+
interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandlers, IDBEnvironment, WindowBase64, WindowConsole, WindowEventHandlers, WindowLocalStorage, WindowOrWorkerGlobalScope, WindowSessionStorage {
1854018530
readonly applicationCache: ApplicationCache;
1854118531
readonly caches: CacheStorage;
1854218532
readonly clientInformation: Navigator;
@@ -18738,7 +18728,7 @@ interface WindowOrWorkerGlobalScope {
1873818728
createImageBitmap(image: ImageBitmapSource): Promise<ImageBitmap>;
1873918729
createImageBitmap(image: ImageBitmapSource, sx: number, sy: number, sw: number, sh: number): Promise<ImageBitmap>;
1874018730
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
18741-
queueMicrotask(callback: Function): void;
18731+
queueMicrotask(callback: VoidFunction): void;
1874218732
setInterval(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
1874318733
setTimeout(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
1874418734
}
@@ -18747,9 +18737,6 @@ interface WindowSessionStorage {
1874718737
readonly sessionStorage: Storage;
1874818738
}
1874918739

18750-
interface WindowTimers {
18751-
}
18752-
1875318740
interface WorkerEventMap extends AbstractWorkerEventMap {
1875418741
"message": MessageEvent;
1875518742
}
@@ -19211,6 +19198,10 @@ interface BlobCallback {
1921119198
(blob: Blob | null): void;
1921219199
}
1921319200

19201+
interface CustomElementConstructor {
19202+
(): any;
19203+
}
19204+
1921419205
interface DecodeErrorCallback {
1921519206
(error: DOMException): void;
1921619207
}
@@ -19797,7 +19788,6 @@ declare var onloadeddata: ((this: Window, ev: Event) => any) | null;
1979719788
* @param ev The event.
1979819789
*/
1979919790
declare var onloadedmetadata: ((this: Window, ev: Event) => any) | null;
19800-
declare var onloadend: ((this: Window, ev: ProgressEvent) => any) | null;
1980119791
/**
1980219792
* Occurs when Internet Explorer begins looking for media data.
1980319793
* @param ev The event.
@@ -19946,7 +19936,7 @@ declare function clearTimeout(handle?: number): void;
1994619936
declare function createImageBitmap(image: ImageBitmapSource): Promise<ImageBitmap>;
1994719937
declare function createImageBitmap(image: ImageBitmapSource, sx: number, sy: number, sw: number, sh: number): Promise<ImageBitmap>;
1994819938
declare function fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
19949-
declare function queueMicrotask(callback: Function): void;
19939+
declare function queueMicrotask(callback: VoidFunction): void;
1995019940
declare function setInterval(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
1995119941
declare function setTimeout(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
1995219942
declare var sessionStorage: Storage;
@@ -20151,7 +20141,7 @@ type ScrollLogicalPosition = "start" | "center" | "end" | "nearest";
2015120141
type ScrollRestoration = "auto" | "manual";
2015220142
type ScrollSetting = "" | "up";
2015320143
type SelectionMode = "select" | "start" | "end" | "preserve";
20154-
type ServiceWorkerState = "installing" | "installed" | "activating" | "activated" | "redundant";
20144+
type ServiceWorkerState = "parsed" | "installing" | "installed" | "activating" | "activated" | "redundant";
2015520145
type ServiceWorkerUpdateViaCache = "imports" | "all" | "none";
2015620146
type ShadowRootMode = "open" | "closed";
2015720147
type SpeechRecognitionErrorCode = "no-speech" | "aborted" | "audio-capture" | "network" | "not-allowed" | "service-not-allowed" | "bad-grammar" | "language-not-supported";

baselines/webworker.generated.d.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ interface PushPermissionDescriptor extends PermissionDescriptor {
350350
userVisibleOnly?: boolean;
351351
}
352352

353-
interface PushSubscriptionChangeInit extends ExtendableEventInit {
353+
interface PushSubscriptionChangeEventInit extends ExtendableEventInit {
354354
newSubscription?: PushSubscription;
355355
oldSubscription?: PushSubscription;
356356
}
@@ -632,7 +632,10 @@ interface AnimationFrameProvider {
632632
interface Blob {
633633
readonly size: number;
634634
readonly type: string;
635+
arrayBuffer(): Promise<ArrayBuffer>;
635636
slice(start?: number, end?: number, contentType?: string): Blob;
637+
stream(): ReadableStream;
638+
text(): Promise<string>;
636639
}
637640

638641
declare var Blob: {
@@ -1465,7 +1468,7 @@ interface EventTarget {
14651468
*
14661469
* When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
14671470
*
1468-
* When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in §2.8 Observing event listeners.
1471+
* When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
14691472
*
14701473
* When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
14711474
*
@@ -2705,7 +2708,7 @@ interface PushSubscriptionChangeEvent extends ExtendableEvent {
27052708

27062709
declare var PushSubscriptionChangeEvent: {
27072710
prototype: PushSubscriptionChangeEvent;
2708-
new(type: string, eventInitDict?: PushSubscriptionChangeInit): PushSubscriptionChangeEvent;
2711+
new(type: string, eventInitDict?: PushSubscriptionChangeEventInit): PushSubscriptionChangeEvent;
27092712
};
27102713

27112714
interface PushSubscriptionOptions {
@@ -2948,6 +2951,7 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
29482951
onpushsubscriptionchange: ((this: ServiceWorkerGlobalScope, ev: PushSubscriptionChangeEvent) => any) | null;
29492952
onsync: ((this: ServiceWorkerGlobalScope, ev: SyncEvent) => any) | null;
29502953
readonly registration: ServiceWorkerRegistration;
2954+
readonly serviceWorker: ServiceWorker;
29512955
skipWaiting(): Promise<void>;
29522956
addEventListener<K extends keyof ServiceWorkerGlobalScopeEventMap>(type: K, listener: (this: ServiceWorkerGlobalScope, ev: ServiceWorkerGlobalScopeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
29532957
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -5336,7 +5340,7 @@ interface WindowOrWorkerGlobalScope {
53365340
createImageBitmap(image: ImageBitmapSource): Promise<ImageBitmap>;
53375341
createImageBitmap(image: ImageBitmapSource, sx: number, sy: number, sw: number, sh: number): Promise<ImageBitmap>;
53385342
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
5339-
queueMicrotask(callback: Function): void;
5343+
queueMicrotask(callback: VoidFunction): void;
53405344
setInterval(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
53415345
setTimeout(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
53425346
}
@@ -5741,6 +5745,10 @@ interface TransformStreamDefaultControllerTransformCallback<I, O> {
57415745
(chunk: I, controller: TransformStreamDefaultController<O>): void | PromiseLike<void>;
57425746
}
57435747

5748+
interface VoidFunction {
5749+
(): void;
5750+
}
5751+
57445752
interface WritableStreamDefaultControllerCloseCallback {
57455753
(): void | PromiseLike<void>;
57465754
}
@@ -5795,7 +5803,7 @@ declare function clearTimeout(handle?: number): void;
57955803
declare function createImageBitmap(image: ImageBitmapSource): Promise<ImageBitmap>;
57965804
declare function createImageBitmap(image: ImageBitmapSource, sx: number, sy: number, sw: number, sh: number): Promise<ImageBitmap>;
57975805
declare function fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
5798-
declare function queueMicrotask(callback: Function): void;
5806+
declare function queueMicrotask(callback: VoidFunction): void;
57995807
declare function setInterval(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
58005808
declare function setTimeout(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
58015809
declare function cancelAnimationFrame(handle: number): void;
@@ -5874,7 +5882,7 @@ type RequestDestination = "" | "audio" | "audioworklet" | "document" | "embed" |
58745882
type RequestMode = "navigate" | "same-origin" | "no-cors" | "cors";
58755883
type RequestRedirect = "follow" | "error" | "manual";
58765884
type ResponseType = "basic" | "cors" | "default" | "error" | "opaque" | "opaqueredirect";
5877-
type ServiceWorkerState = "installing" | "installed" | "activating" | "activated" | "redundant";
5885+
type ServiceWorkerState = "parsed" | "installing" | "installed" | "activating" | "activated" | "redundant";
58785886
type ServiceWorkerUpdateViaCache = "imports" | "all" | "none";
58795887
type VisibilityState = "hidden" | "visible";
58805888
type WebGLPowerPreference = "default" | "low-power" | "high-performance";

inputfiles/addedTypes.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,10 @@
489489
"userSelect": {
490490
"name": "userSelect",
491491
"type": "CSSOMString"
492+
},
493+
"webkitAppearance": {
494+
"nullable": 0,
495+
"deprecated": 1
492496
}
493497
}
494498
}

0 commit comments

Comments
 (0)