Skip to content

Update TypeScript DOM Libs #46222

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

Merged
merged 1 commit into from
Oct 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
278 changes: 186 additions & 92 deletions src/lib/dom.generated.d.ts

Large diffs are not rendered by default.

8 changes: 1 addition & 7 deletions src/lib/dom.iterable.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ interface NamedNodeMap {
}

interface Navigator {
/** Available only in secure contexts. */
requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: Iterable<MediaKeySystemConfiguration>): Promise<MediaKeySystemAccess>;
vibrate(pattern: Iterable<number>): boolean;
}
Expand Down Expand Up @@ -170,13 +171,6 @@ interface PluginArray {
interface RTCStatsReport extends ReadonlyMap<string, any> {
}

interface ReadableStream<R = any> {
[Symbol.iterator](): IterableIterator<any>;
entries(): IterableIterator<[number, any]>;
keys(): IterableIterator<number>;
values(): IterableIterator<any>;
}

interface SVGLengthList {
[Symbol.iterator](): IterableIterator<SVGLength>;
}
Expand Down
79 changes: 60 additions & 19 deletions src/lib/webworker.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ interface RequestInit {
/** An AbortSignal to set request's signal. */
signal?: AbortSignal | null;
/** Can only be null. Used to disassociate request from any Window. */
window?: any;
window?: null;
}

interface ResponseInit {
Expand Down Expand Up @@ -671,7 +671,7 @@ interface AbortSignal extends EventTarget {
declare var AbortSignal: {
prototype: AbortSignal;
new(): AbortSignal;
// abort(): AbortSignal;
// abort(): AbortSignal; - To be re-added in the future
};

interface AbstractWorkerEventMap {
Expand Down Expand Up @@ -752,7 +752,10 @@ declare var ByteLengthQueuingStrategy: {
new(init: QueuingStrategyInit): ByteLengthQueuingStrategy;
};

/** Provides a storage mechanism for Request / Response object pairs that are cached, for example as part of the ServiceWorker life cycle. Note that the Cache interface is exposed to windowed scopes as well as workers. You don't have to use it in conjunction with service workers, even though it is defined in the service worker spec. */
/**
* Provides a storage mechanism for Request / Response object pairs that are cached, for example as part of the ServiceWorker life cycle. Note that the Cache interface is exposed to windowed scopes as well as workers. You don't have to use it in conjunction with service workers, even though it is defined in the service worker spec.
* Available only in secure contexts.
*/
interface Cache {
add(request: RequestInfo): Promise<void>;
addAll(requests: RequestInfo[]): Promise<void>;
Expand All @@ -768,7 +771,10 @@ declare var Cache: {
new(): Cache;
};

/** The storage for Cache objects. */
/**
* The storage for Cache objects.
* Available only in secure contexts.
*/
interface CacheStorage {
delete(cacheName: string): Promise<boolean>;
has(cacheName: string): Promise<boolean>;
Expand Down Expand Up @@ -876,6 +882,7 @@ declare var CountQueuingStrategy: {

/** Basic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives. */
interface Crypto {
/** Available only in secure contexts. */
readonly subtle: SubtleCrypto;
getRandomValues<T extends ArrayBufferView | null>(array: T): T;
}
Expand All @@ -885,7 +892,10 @@ declare var Crypto: {
new(): Crypto;
};

/** The CryptoKey dictionary of the Web Crypto API represents a cryptographic key. */
/**
* The CryptoKey dictionary of the Web Crypto API represents a cryptographic key.
* Available only in secure contexts.
*/
interface CryptoKey {
readonly algorithm: KeyAlgorithm;
readonly extractable: boolean;
Expand Down Expand Up @@ -2137,6 +2147,7 @@ interface NavigatorOnLine {
readonly onLine: boolean;
}

/** Available only in secure contexts. */
interface NavigatorStorage {
readonly storage: StorageManager;
}
Expand Down Expand Up @@ -2431,7 +2442,10 @@ declare var PromiseRejectionEvent: {
new(type: string, eventInitDict: PromiseRejectionEventInit): PromiseRejectionEvent;
};

/** This Push API interface represents a push message that has been received. This event is sent to the global scope of a ServiceWorker. It contains the information sent from an application server to a PushSubscription. */
/**
* This Push API interface represents a push message that has been received. This event is sent to the global scope of a ServiceWorker. It contains the information sent from an application server to a PushSubscription.
* Available only in secure contexts.
*/
interface PushEvent extends ExtendableEvent {
readonly data: PushMessageData | null;
}
Expand All @@ -2441,7 +2455,10 @@ declare var PushEvent: {
new(type: string, eventInitDict?: PushEventInit): PushEvent;
};

/** This Push API interface provides a way to receive notifications from third-party servers as well as request URLs for push notifications. */
/**
* This Push API interface provides a way to receive notifications from third-party servers as well as request URLs for push notifications.
* Available only in secure contexts.
*/
interface PushManager {
getSubscription(): Promise<PushSubscription | null>;
permissionState(options?: PushSubscriptionOptionsInit): Promise<PushPermissionState>;
Expand All @@ -2454,7 +2471,10 @@ declare var PushManager: {
readonly supportedContentEncodings: ReadonlyArray<string>;
};

/** This Push API interface provides methods which let you retrieve the push data sent by a server in various formats. */
/**
* This Push API interface provides methods which let you retrieve the push data sent by a server in various formats.
* Available only in secure contexts.
*/
interface PushMessageData {
arrayBuffer(): ArrayBuffer;
blob(): Blob;
Expand All @@ -2467,7 +2487,10 @@ declare var PushMessageData: {
new(): PushMessageData;
};

/** This Push API interface provides a subcription's URL endpoint and allows unsubscription from a push service. */
/**
* This Push API interface provides a subcription's URL endpoint and allows unsubscription from a push service.
* Available only in secure contexts.
*/
interface PushSubscription {
readonly endpoint: string;
readonly options: PushSubscriptionOptions;
Expand All @@ -2481,6 +2504,7 @@ declare var PushSubscription: {
new(): PushSubscription;
};

/** Available only in secure contexts. */
interface PushSubscriptionOptions {
readonly applicationServerKey: ArrayBuffer | null;
}
Expand All @@ -2498,7 +2522,6 @@ interface ReadableStream<R = any> {
pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;
pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;
tee(): [ReadableStream<R>, ReadableStream<R>];
forEach(callbackfn: (value: any, key: number, parent: ReadableStream<R>) => void, thisArg?: any): void;
}

declare var ReadableStream: {
Expand Down Expand Up @@ -2613,7 +2636,10 @@ interface ServiceWorkerEventMap extends AbstractWorkerEventMap {
"statechange": Event;
}

/** This ServiceWorker API interface provides a reference to a service worker. Multiple browsing contexts (e.g. pages, workers, etc.) can be associated with the same service worker, each through a unique ServiceWorker object. */
/**
* This ServiceWorker API interface provides a reference to a service worker. Multiple browsing contexts (e.g. pages, workers, etc.) can be associated with the same service worker, each through a unique ServiceWorker object.
* Available only in secure contexts.
*/
interface ServiceWorker extends EventTarget, AbstractWorker {
onstatechange: ((this: ServiceWorker, ev: Event) => any) | null;
readonly scriptURL: string;
Expand All @@ -2637,7 +2663,10 @@ interface ServiceWorkerContainerEventMap {
"messageerror": MessageEvent;
}

/** The ServiceWorkerContainer interface of the ServiceWorker API provides an object representing the service worker as an overall unit in the network ecosystem, including facilities to register, unregister and update service workers, and access the state of service workers and their registrations. */
/**
* The ServiceWorkerContainer interface of the ServiceWorker API provides an object representing the service worker as an overall unit in the network ecosystem, including facilities to register, unregister and update service workers, and access the state of service workers and their registrations.
* Available only in secure contexts.
*/
interface ServiceWorkerContainer extends EventTarget {
readonly controller: ServiceWorker | null;
oncontrollerchange: ((this: ServiceWorkerContainer, ev: Event) => any) | null;
Expand Down Expand Up @@ -2698,7 +2727,10 @@ interface ServiceWorkerRegistrationEventMap {
"updatefound": Event;
}

/** This ServiceWorker API interface represents the service worker registration. You register a service worker to control one or more pages that share the same origin. */
/**
* This ServiceWorker API interface represents the service worker registration. You register a service worker to control one or more pages that share the same origin.
* Available only in secure contexts.
*/
interface ServiceWorkerRegistration extends EventTarget {
readonly active: ServiceWorker | null;
readonly installing: ServiceWorker | null;
Expand Down Expand Up @@ -2743,6 +2775,7 @@ declare var SharedWorkerGlobalScope: {
new(): SharedWorkerGlobalScope;
};

/** Available only in secure contexts. */
interface StorageManager {
estimate(): Promise<StorageEstimate>;
persisted(): Promise<boolean>;
Expand All @@ -2753,7 +2786,10 @@ declare var StorageManager: {
new(): StorageManager;
};

/** This Web Crypto API interface provides a number of low-level cryptographic functions. It is accessed via the Crypto.subtle properties available in a window context (via Window.crypto). */
/**
* This Web Crypto API interface provides a number of low-level cryptographic functions. It is accessed via the Crypto.subtle properties available in a window context (via Window.crypto).
* Available only in secure contexts.
*/
interface SubtleCrypto {
decrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise<any>;
deriveBits(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, length: number): Promise<ArrayBuffer>;
Expand Down Expand Up @@ -5030,6 +5066,7 @@ declare var WindowClient: {
};

interface WindowOrWorkerGlobalScope {
/** Available only in secure contexts. */
readonly caches: CacheStorage;
readonly crossOriginIsolated: boolean;
readonly crypto: Crypto;
Expand Down Expand Up @@ -5352,7 +5389,8 @@ declare namespace WebAssembly {

var CompileError: {
prototype: CompileError;
new(): CompileError;
new(message?: string): CompileError;
(message?: string): CompileError;
};

interface Global {
Expand All @@ -5379,7 +5417,8 @@ declare namespace WebAssembly {

var LinkError: {
prototype: LinkError;
new(): LinkError;
new(message?: string): LinkError;
(message?: string): LinkError;
};

interface Memory {
Expand Down Expand Up @@ -5408,7 +5447,8 @@ declare namespace WebAssembly {

var RuntimeError: {
prototype: RuntimeError;
new(): RuntimeError;
new(message?: string): RuntimeError;
(message?: string): RuntimeError;
};

interface Table {
Expand Down Expand Up @@ -5485,7 +5525,7 @@ interface PerformanceObserverCallback {
}

interface QueuingStrategySize<T = any> {
(chunk?: T): number;
(chunk: T): number;
}

interface TransformerFlushCallback<O> {
Expand Down Expand Up @@ -5560,6 +5600,7 @@ declare function importScripts(...urls: (string | URL)[]): 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. */
declare function dispatchEvent(event: Event): boolean;
declare var fonts: FontFaceSet;
/** Available only in secure contexts. */
declare var caches: CacheStorage;
declare var crossOriginIsolated: boolean;
declare var crypto: Crypto;
Expand Down Expand Up @@ -5648,7 +5689,7 @@ type MediaDecodingType = "file" | "media-source" | "webrtc";
type MediaEncodingType = "record" | "webrtc";
type NotificationDirection = "auto" | "ltr" | "rtl";
type NotificationPermission = "default" | "denied" | "granted";
type PermissionName = "geolocation" | "notifications" | "persistent-storage" | "push" | "screen-wake-lock";
type PermissionName = "geolocation" | "notifications" | "persistent-storage" | "push" | "screen-wake-lock" | "xr-spatial-tracking";
type PermissionState = "denied" | "granted" | "prompt";
type PredefinedColorSpace = "display-p3" | "srgb";
type PremultiplyAlpha = "default" | "none" | "premultiply";
Expand Down
7 changes: 0 additions & 7 deletions src/lib/webworker.iterable.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,6 @@ interface MessageEvent<T = any> {
initMessageEvent(type: string, bubbles?: boolean, cancelable?: boolean, data?: any, origin?: string, lastEventId?: string, source?: MessageEventSource | null, ports?: Iterable<MessagePort>): void;
}

interface ReadableStream<R = any> {
[Symbol.iterator](): IterableIterator<any>;
entries(): IterableIterator<[number, any]>;
keys(): IterableIterator<number>;
values(): IterableIterator<any>;
}

interface SubtleCrypto {
deriveKey(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: AlgorithmIdentifier | AesDerivedKeyParams | HmacImportParams | HkdfParams | Pbkdf2Params, extractable: boolean, keyUsages: Iterable<KeyUsage>): Promise<CryptoKey>;
generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKeyPair>;
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/extendArray.errors.txt
Original file line number Diff line number Diff line change
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:4792:13: 'Element' is declared here.
!!! related TS2728 /.ts/lib.dom.d.ts:4829:13: 'Element' is declared here.
~~~~~~~~
!!! error TS2552: Cannot find name '_element'. Did you mean 'Element'?
!!! related TS2728 /.ts/lib.dom.d.ts:4792:13: 'Element' is declared here.
!!! related TS2728 /.ts/lib.dom.d.ts:4829:13: 'Element' is declared here.
}
}

Expand Down
Loading