Skip to content

Commit

Permalink
DOM update 2022/09/21 (#50884)
Browse files Browse the repository at this point in the history
  • Loading branch information
sandersn committed Sep 21, 2022
1 parent 1d9ab83 commit e2dd508
Show file tree
Hide file tree
Showing 11 changed files with 296 additions and 106 deletions.
257 changes: 199 additions & 58 deletions src/lib/dom.generated.d.ts

Large diffs are not rendered by default.

97 changes: 73 additions & 24 deletions src/lib/webworker.generated.d.ts
Expand Up @@ -480,9 +480,18 @@ interface RTCEncodedVideoFrameMetadata {
width?: number;
}

interface ReadableStreamReadDoneResult {
interface ReadableStreamGetReaderOptions {
/**
* Creates a ReadableStreamBYOBReader and locks the stream to the new reader.
*
* This call behaves the same way as the no-argument variant, except that it only works on readable byte streams, i.e. streams which were constructed specifically with the ability to handle "bring your own buffer" reading. The returned BYOB reader provides the ability to directly read individual chunks from the stream via its read() method, into developer-supplied buffers, allowing more precise control over allocation.
*/
mode?: ReadableStreamReaderMode;
}

interface ReadableStreamReadDoneResult<T> {
done: true;
value?: undefined;
value?: T;
}

interface ReadableStreamReadValueResult<T> {
Expand Down Expand Up @@ -638,6 +647,21 @@ interface Transformer<I = any, O = any> {
writableType?: undefined;
}

interface UnderlyingByteSource {
autoAllocateChunkSize?: number;
cancel?: UnderlyingSourceCancelCallback;
pull?: (controller: ReadableByteStreamController) => void | PromiseLike<void>;
start?: (controller: ReadableByteStreamController) => any;
type: "bytes";
}

interface UnderlyingDefaultSource<R = any> {
cancel?: UnderlyingSourceCancelCallback;
pull?: (controller: ReadableStreamDefaultController<R>) => void | PromiseLike<void>;
start?: (controller: ReadableStreamDefaultController<R>) => any;
type?: undefined;
}

interface UnderlyingSink<W = any> {
abort?: UnderlyingSinkAbortCallback;
close?: UnderlyingSinkCloseCallback;
Expand All @@ -647,10 +671,11 @@ interface UnderlyingSink<W = any> {
}

interface UnderlyingSource<R = any> {
autoAllocateChunkSize?: number;
cancel?: UnderlyingSourceCancelCallback;
pull?: UnderlyingSourcePullCallback<R>;
start?: UnderlyingSourceStartCallback<R>;
type?: undefined;
type?: ReadableStreamType;
}

interface VideoColorSpaceInit {
Expand Down Expand Up @@ -736,6 +761,7 @@ declare var AbortSignal: {
prototype: AbortSignal;
new(): AbortSignal;
abort(reason?: any): AbortSignal;
timeout(milliseconds: number): AbortSignal;
};

interface AbstractWorkerEventMap {
Expand Down Expand Up @@ -1296,6 +1322,13 @@ interface EXT_sRGB {
interface EXT_shader_texture_lod {
}

interface EXT_texture_compression_bptc {
readonly COMPRESSED_RGBA_BPTC_UNORM_EXT: GLenum;
readonly COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT: GLenum;
readonly COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT: GLenum;
readonly COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT: GLenum;
}

interface EXT_texture_compression_rgtc {
readonly COMPRESSED_RED_GREEN_RGTC2_EXT: GLenum;
readonly COMPRESSED_RED_RGTC1_EXT: GLenum;
Expand Down Expand Up @@ -1327,6 +1360,7 @@ declare var ErrorEvent: {
interface Event {
/** 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. */
readonly bubbles: boolean;
/** @deprecated */
cancelBubble: boolean;
/** Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method. */
readonly cancelable: boolean;
Expand Down Expand Up @@ -2010,13 +2044,13 @@ declare var IDBObjectStore: {
};

interface IDBOpenDBRequestEventMap extends IDBRequestEventMap {
"blocked": Event;
"blocked": IDBVersionChangeEvent;
"upgradeneeded": IDBVersionChangeEvent;
}

/** Also inherits methods from its parents IDBRequest and EventTarget. */
interface IDBOpenDBRequest extends IDBRequest<IDBDatabase> {
onblocked: ((this: IDBOpenDBRequest, ev: Event) => any) | null;
onblocked: ((this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any) | null;
onupgradeneeded: ((this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any) | null;
addEventListener<K extends keyof IDBOpenDBRequestEventMap>(type: K, listener: (this: IDBOpenDBRequest, ev: IDBOpenDBRequestEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
Expand Down Expand Up @@ -2272,6 +2306,7 @@ interface NavigatorID {
readonly appName: string;
/** @deprecated */
readonly appVersion: string;
/** @deprecated */
readonly platform: string;
/** @deprecated */
readonly product: string;
Expand Down Expand Up @@ -2533,6 +2568,7 @@ interface PermissionStatusEventMap {
}

interface PermissionStatus extends EventTarget {
readonly name: string;
onchange: ((this: PermissionStatus, ev: Event) => any) | null;
readonly state: PermissionState;
addEventListener<K extends keyof PermissionStatusEventMap>(type: K, listener: (this: PermissionStatus, ev: PermissionStatusEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
Expand Down Expand Up @@ -2644,6 +2680,7 @@ declare var PushSubscription: {
/** Available only in secure contexts. */
interface PushSubscriptionOptions {
readonly applicationServerKey: ArrayBuffer | null;
readonly userVisibleOnly: boolean;
}

declare var PushSubscriptionOptions: {
Expand Down Expand Up @@ -2691,19 +2728,23 @@ declare var ReadableByteStreamController: {
interface ReadableStream<R = any> {
readonly locked: boolean;
cancel(reason?: any): Promise<void>;
getReader(options: { mode: "byob" }): ReadableStreamBYOBReader;
getReader(): ReadableStreamDefaultReader<R>;
getReader(options?: ReadableStreamGetReaderOptions): ReadableStreamReader<R>;
pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;
pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;
tee(): [ReadableStream<R>, ReadableStream<R>];
}

declare var ReadableStream: {
prototype: ReadableStream;
new(underlyingSource: UnderlyingByteSource, strategy?: { highWaterMark?: number }): ReadableStream<Uint8Array>;
new<R = any>(underlyingSource: UnderlyingDefaultSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
new<R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
};

interface ReadableStreamBYOBReader extends ReadableStreamGenericReader {
read(view: ArrayBufferView): Promise<ReadableStreamReadResult<ArrayBufferView>>;
read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;
releaseLock(): void;
}

Expand Down Expand Up @@ -2891,6 +2932,7 @@ interface ServiceWorkerGlobalScopeEventMap extends WorkerGlobalScopeEventMap {
"notificationclick": NotificationEvent;
"notificationclose": NotificationEvent;
"push": PushEvent;
"pushsubscriptionchange": Event;
}

/** This ServiceWorker API interface represents the global execution context of a service worker. */
Expand All @@ -2904,6 +2946,7 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
onnotificationclick: ((this: ServiceWorkerGlobalScope, ev: NotificationEvent) => any) | null;
onnotificationclose: ((this: ServiceWorkerGlobalScope, ev: NotificationEvent) => any) | null;
onpush: ((this: ServiceWorkerGlobalScope, ev: PushEvent) => any) | null;
onpushsubscriptionchange: ((this: ServiceWorkerGlobalScope, ev: Event) => any) | null;
readonly registration: ServiceWorkerRegistration;
readonly serviceWorker: ServiceWorker;
skipWaiting(): Promise<void>;
Expand Down Expand Up @@ -3320,8 +3363,8 @@ interface WEBGL_lose_context {
interface WEBGL_multi_draw {
multiDrawArraysInstancedWEBGL(mode: GLenum, firstsList: Int32Array | GLint[], firstsOffset: GLuint, countsList: Int32Array | GLsizei[], countsOffset: GLuint, instanceCountsList: Int32Array | GLsizei[], instanceCountsOffset: GLuint, drawcount: GLsizei): void;
multiDrawArraysWEBGL(mode: GLenum, firstsList: Int32Array | GLint[], firstsOffset: GLuint, countsList: Int32Array | GLsizei[], countsOffset: GLuint, drawcount: GLsizei): void;
multiDrawElementsInstancedWEBGL(mode: GLenum, countsList: Int32Array | GLint[], countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | GLsizei[], offsetsOffset: GLuint, instanceCountsList: Int32Array | GLsizei[], instanceCountsOffset: GLuint, drawcount: GLsizei): void;
multiDrawElementsWEBGL(mode: GLenum, countsList: Int32Array | GLint[], countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | GLsizei[], offsetsOffset: GLuint, drawcount: GLsizei): void;
multiDrawElementsInstancedWEBGL(mode: GLenum, countsList: Int32Array | GLsizei[], countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | GLsizei[], offsetsOffset: GLuint, instanceCountsList: Int32Array | GLsizei[], instanceCountsOffset: GLuint, drawcount: GLsizei): void;
multiDrawElementsWEBGL(mode: GLenum, countsList: Int32Array | GLsizei[], countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | GLsizei[], offsetsOffset: GLuint, drawcount: GLsizei): void;
}

interface WebGL2RenderingContext extends WebGL2RenderingContextBase, WebGL2RenderingContextOverloads, WebGLRenderingContextBase {
Expand Down Expand Up @@ -4719,35 +4762,39 @@ interface WebGLRenderingContextBase {
getBufferParameter(target: GLenum, pname: GLenum): any;
getContextAttributes(): WebGLContextAttributes | null;
getError(): GLenum;
getExtension(extensionName: "ANGLE_instanced_arrays"): ANGLE_instanced_arrays | null;
getExtension(extensionName: "EXT_blend_minmax"): EXT_blend_minmax | null;
getExtension(extensionName: "EXT_color_buffer_float"): EXT_color_buffer_float | null;
getExtension(extensionName: "EXT_color_buffer_half_float"): EXT_color_buffer_half_float | null;
getExtension(extensionName: "EXT_float_blend"): EXT_float_blend | null;
getExtension(extensionName: "EXT_texture_filter_anisotropic"): EXT_texture_filter_anisotropic | null;
getExtension(extensionName: "EXT_frag_depth"): EXT_frag_depth | null;
getExtension(extensionName: "EXT_shader_texture_lod"): EXT_shader_texture_lod | null;
getExtension(extensionName: "EXT_sRGB"): EXT_sRGB | null;
getExtension(extensionName: "EXT_shader_texture_lod"): EXT_shader_texture_lod | null;
getExtension(extensionName: "EXT_texture_compression_bptc"): EXT_texture_compression_bptc | null;
getExtension(extensionName: "EXT_texture_compression_rgtc"): EXT_texture_compression_rgtc | null;
getExtension(extensionName: "EXT_texture_filter_anisotropic"): EXT_texture_filter_anisotropic | null;
getExtension(extensionName: "KHR_parallel_shader_compile"): KHR_parallel_shader_compile | null;
getExtension(extensionName: "OES_element_index_uint"): OES_element_index_uint | null;
getExtension(extensionName: "OES_fbo_render_mipmap"): OES_fbo_render_mipmap | null;
getExtension(extensionName: "OES_standard_derivatives"): OES_standard_derivatives | null;
getExtension(extensionName: "OES_texture_float"): OES_texture_float | null;
getExtension(extensionName: "OES_texture_float_linear"): OES_texture_float_linear | null;
getExtension(extensionName: "OES_texture_half_float"): OES_texture_half_float | null;
getExtension(extensionName: "OES_texture_half_float_linear"): OES_texture_half_float_linear | null;
getExtension(extensionName: "OES_vertex_array_object"): OES_vertex_array_object | null;
getExtension(extensionName: "OVR_multiview2"): OVR_multiview2 | null;
getExtension(extensionName: "WEBGL_color_buffer_float"): WEBGL_color_buffer_float | null;
getExtension(extensionName: "WEBGL_compressed_texture_astc"): WEBGL_compressed_texture_astc | null;
getExtension(extensionName: "WEBGL_compressed_texture_etc"): WEBGL_compressed_texture_etc | null;
getExtension(extensionName: "WEBGL_compressed_texture_etc1"): WEBGL_compressed_texture_etc1 | null;
getExtension(extensionName: "WEBGL_compressed_texture_s3tc"): WEBGL_compressed_texture_s3tc | null;
getExtension(extensionName: "WEBGL_compressed_texture_s3tc_srgb"): WEBGL_compressed_texture_s3tc_srgb | null;
getExtension(extensionName: "WEBGL_debug_renderer_info"): WEBGL_debug_renderer_info | null;
getExtension(extensionName: "WEBGL_debug_shaders"): WEBGL_debug_shaders | null;
getExtension(extensionName: "WEBGL_depth_texture"): WEBGL_depth_texture | null;
getExtension(extensionName: "WEBGL_draw_buffers"): WEBGL_draw_buffers | null;
getExtension(extensionName: "WEBGL_lose_context"): WEBGL_lose_context | null;
getExtension(extensionName: "WEBGL_depth_texture"): WEBGL_depth_texture | null;
getExtension(extensionName: "WEBGL_debug_renderer_info"): WEBGL_debug_renderer_info | null;
getExtension(extensionName: "WEBGL_compressed_texture_s3tc"): WEBGL_compressed_texture_s3tc | null;
getExtension(extensionName: "OES_texture_half_float_linear"): OES_texture_half_float_linear | null;
getExtension(extensionName: "OES_texture_half_float"): OES_texture_half_float | null;
getExtension(extensionName: "OES_texture_float_linear"): OES_texture_float_linear | null;
getExtension(extensionName: "OES_texture_float"): OES_texture_float | null;
getExtension(extensionName: "OES_standard_derivatives"): OES_standard_derivatives | null;
getExtension(extensionName: "OES_element_index_uint"): OES_element_index_uint | null;
getExtension(extensionName: "ANGLE_instanced_arrays"): ANGLE_instanced_arrays | null;
getExtension(extensionName: "WEBGL_multi_draw"): WEBGL_multi_draw | null;
getExtension(name: string): any;
getFramebufferAttachmentParameter(target: GLenum, attachment: GLenum, pname: GLenum): any;
getParameter(pname: GLenum): any;
Expand Down Expand Up @@ -5876,13 +5923,13 @@ type NamedCurve = string;
type OnErrorEventHandler = OnErrorEventHandlerNonNull | null;
type PerformanceEntryList = PerformanceEntry[];
type PushMessageDataInit = BufferSource | string;
type ReadableStreamController<T> = ReadableStreamDefaultController<T>;
type ReadableStreamReadResult<T> = ReadableStreamReadValueResult<T> | ReadableStreamReadDoneResult;
type ReadableStreamReader<T> = ReadableStreamDefaultReader<T>;
type ReadableStreamController<T> = ReadableStreamDefaultController<T> | ReadableByteStreamController;
type ReadableStreamReadResult<T> = ReadableStreamReadValueResult<T> | ReadableStreamReadDoneResult<T>;
type ReadableStreamReader<T> = ReadableStreamDefaultReader<T> | ReadableStreamBYOBReader;
type RequestInfo = Request | string;
type TexImageSource = ImageBitmap | ImageData | OffscreenCanvas;
type TimerHandler = string | Function;
type Transferable = ArrayBuffer | MessagePort | ImageBitmap;
type Transferable = OffscreenCanvas | ImageBitmap | MessagePort | ReadableStream | WritableStream | TransformStream | ArrayBuffer;
type Uint32List = Uint32Array | GLuint[];
type VibratePattern = number | number[];
type XMLHttpRequestBodyInit = Blob | BufferSource | FormData | URLSearchParams | string;
Expand Down Expand Up @@ -5916,6 +5963,8 @@ type PredefinedColorSpace = "display-p3" | "srgb";
type PremultiplyAlpha = "default" | "none" | "premultiply";
type PushEncryptionKeyName = "auth" | "p256dh";
type RTCEncodedVideoFrameType = "delta" | "empty" | "key";
type ReadableStreamReaderMode = "byob";
type ReadableStreamType = "bytes";
type ReferrerPolicy = "" | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url";
type RequestCache = "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload";
type RequestCredentials = "include" | "omit" | "same-origin";
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/baseCheck.errors.txt
Expand Up @@ -21,7 +21,7 @@ tests/cases/compiler/baseCheck.ts(26,9): error TS2304: Cannot find name 'x'.
super(0, loc);
~~~
!!! error TS2552: Cannot find name 'loc'. Did you mean 'Lock'?
!!! related TS2728 /.ts/lib.dom.d.ts:9117:13: 'Lock' is declared here.
!!! related TS2728 /.ts/lib.dom.d.ts:9241:13: 'Lock' is declared here.
}

m() {
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/extendArray.errors.txt
Expand Up @@ -12,10 +12,10 @@ tests/cases/compiler/extendArray.ts(7,32): error TS2552: Cannot find name '_elem
collect(fn:(e:_element) => _element[]) : any[];
~~~~~~~~
!!! error TS2552: Cannot find name '_element'. Did you mean 'Element'?
!!! related TS2728 /.ts/lib.dom.d.ts:4969:13: 'Element' is declared here.
!!! related TS2728 /.ts/lib.dom.d.ts:5089:13: 'Element' is declared here.
~~~~~~~~
!!! error TS2552: Cannot find name '_element'. Did you mean 'Element'?
!!! related TS2728 /.ts/lib.dom.d.ts:4969:13: 'Element' is declared here.
!!! related TS2728 /.ts/lib.dom.d.ts:5089:13: 'Element' is declared here.
}
}

Expand Down

0 comments on commit e2dd508

Please sign in to comment.