From d7837c8eb5590317bf005ba84b72c8e78ba06be3 Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Thu, 25 Feb 2021 15:16:19 +1100 Subject: [PATCH] feat(cli): update to TypeScript 4.2 (#9341) --- cli/dts/lib.dom.d.ts | 447 +- cli/dts/lib.es2015.proxy.d.ts | 26 +- cli/dts/lib.es2015.reflect.d.ts | 96 +- cli/dts/lib.es2020.intl.d.ts | 10 + cli/dts/lib.es5.d.ts | 68 +- cli/dts/lib.esnext.intl.d.ts | 2 +- cli/dts/lib.webworker.d.ts | 277 +- cli/dts/typescript.d.ts | 224 +- cli/tests/unit/version_test.ts | 6 +- cli/tsc/00_typescript.js | 8084 ++++++++++++++++++++----------- 10 files changed, 5979 insertions(+), 3261 deletions(-) diff --git a/cli/dts/lib.dom.d.ts b/cli/dts/lib.dom.d.ts index 4624ef1b21..960a6800ea 100644 --- a/cli/dts/lib.dom.d.ts +++ b/cli/dts/lib.dom.d.ts @@ -614,6 +614,10 @@ interface ImageEncodeOptions { type?: string; } +interface ImportMeta { + url: string; +} + interface InputEventInit extends UIEventInit { data?: string | null; inputType?: string; @@ -631,7 +635,7 @@ interface IntersectionObserverEntryInit { } interface IntersectionObserverInit { - root?: Element | null; + root?: Element | Document | null; rootMargin?: string; threshold?: number | number[]; } @@ -662,6 +666,8 @@ interface KeyAlgorithm { } interface KeyboardEventInit extends EventModifierInit { + /** @deprecated */ + charCode?: number; code?: string; isComposing?: boolean; key?: string; @@ -1043,18 +1049,13 @@ interface PermissionDescriptor { name: PermissionName; } -interface PipeOptions { - preventAbort?: boolean; - preventCancel?: boolean; - preventClose?: boolean; - signal?: AbortSignal; -} - interface PointerEventInit extends MouseEventInit { + coalescedEvents?: PointerEvent[]; height?: number; isPrimary?: boolean; pointerId?: number; pointerType?: string; + predictedEvents?: PointerEvent[]; pressure?: number; tangentialPressure?: number; tiltX?: number; @@ -1158,7 +1159,16 @@ interface PushSubscriptionOptionsInit { interface QueuingStrategy { highWaterMark?: number; - size?: QueuingStrategySizeCallback; + size?: QueuingStrategySize; +} + +interface QueuingStrategyInit { + /** + * Creates a new ByteLengthQueuingStrategy with the provided high water mark. + * + * Note that the provided high water mark will not be validated ahead of time. Instead, if it is negative, NaN, or not a number, the resulting ByteLengthQueuingStrategy will cause the corresponding stream constructor to throw. + */ + highWaterMark: number; } interface RTCAnswerOptions extends RTCOfferAnswerOptions { @@ -1259,17 +1269,36 @@ interface RTCIceCandidatePair { interface RTCIceCandidatePairStats extends RTCStats { availableIncomingBitrate?: number; availableOutgoingBitrate?: number; + bytesDiscardedOnSend?: number; bytesReceived?: number; bytesSent?: number; + circuitBreakerTriggerCount?: number; + consentExpiredTimestamp?: number; + consentRequestsSent?: number; + currentRoundTripTime?: number; + currentRtt?: number; + firstRequestTimestamp?: number; + lastPacketReceivedTimestamp?: number; + lastPacketSentTimestamp?: number; + lastRequestTimestamp?: number; + lastResponseTimestamp?: number; localCandidateId?: string; nominated?: boolean; + packetsDiscardedOnSend?: number; + packetsReceived?: number; + packetsSent?: number; priority?: number; - readable?: boolean; remoteCandidateId?: string; - roundTripTime?: number; + requestsReceived?: number; + requestsSent?: number; + responsesReceived?: number; + responsesSent?: number; + retransmissionsReceived?: number; + retransmissionsSent?: number; state?: RTCStatsIceCandidatePairState; + totalRoundTripTime?: number; + totalRtt?: number; transportId?: string; - writable?: boolean; } interface RTCIceGatherOptions { @@ -1507,9 +1536,9 @@ interface RTCSsrcRange { } interface RTCStats { - id: string; - timestamp: number; - type: RTCStatsType; + id?: string; + timestamp?: number; + type?: RTCStatsType; } interface RTCStatsEventInit extends EventInit { @@ -1527,25 +1556,43 @@ interface RTCTrackEventInit extends EventInit { } interface RTCTransportStats extends RTCStats { - activeConnection?: boolean; bytesReceived?: number; bytesSent?: number; + dtlsCipher?: string; + dtlsState?: RTCDtlsTransportState; + iceRole?: RTCIceRole; localCertificateId?: string; + packetsReceived?: number; + packetsSent?: number; remoteCertificateId?: string; rtcpTransportStatsId?: string; + selectedCandidatePairChanges?: number; selectedCandidatePairId?: string; + srtpCipher?: string; + tlsGroup?: string; + tlsVersion?: string; } -interface ReadableStreamReadDoneResult { +interface ReadableStreamDefaultReadDoneResult { done: true; - value?: T; + value?: undefined; } -interface ReadableStreamReadValueResult { +interface ReadableStreamDefaultReadValueResult { done: false; value: T; } +interface ReadableWritablePair { + readable: ReadableStream; + /** + * Provides a convenient, chainable way of piping this readable stream through a transform stream (or any other { writable, readable } pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use. + * + * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader. + */ + writable: WritableStream; +} + interface RegistrationOptions { scope?: string; type?: WorkerType; @@ -1607,6 +1654,10 @@ interface RequestInit { window?: any; } +interface ResizeObserverOptions { + box?: ResizeObserverBoxOptions; +} + interface ResponseInit { headers?: HeadersInit; status?: number; @@ -1720,6 +1771,16 @@ interface ShareData { url?: string; } +interface SpeechRecognitionErrorEventInit extends EventInit { + error: SpeechRecognitionErrorCode; + message?: string; +} + +interface SpeechRecognitionEventInit extends EventInit { + resultIndex?: number; + results: SpeechRecognitionResultList; +} + interface SpeechSynthesisErrorEventInit extends SpeechSynthesisEventInit { error: SpeechSynthesisErrorCode; } @@ -1766,6 +1827,30 @@ interface StoreSiteSpecificExceptionsInformation extends StoreExceptionsInformat arrayOfDomainStrings?: string[]; } +interface StreamPipeOptions { + preventAbort?: boolean; + preventCancel?: boolean; + /** + * Pipes this readable stream to a given writable stream destination. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered. + * + * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader. + * + * Errors and closures of the source and destination streams propagate as follows: + * + * An error in this source readable stream will abort destination, unless preventAbort is truthy. The returned promise will be rejected with the source's error, or with any error that occurs during aborting the destination. + * + * An error in destination will cancel this source readable stream, unless preventCancel is truthy. The returned promise will be rejected with the destination's error, or with any error that occurs during canceling the source. + * + * When this source readable stream closes, destination will be closed, unless preventClose is truthy. The returned promise will be fulfilled once this process completes, unless an error is encountered while closing the destination, in which case it will be rejected with that error. + * + * If destination starts out closed or closing, this source readable stream will be canceled, unless preventCancel is true. The returned promise will be rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source. + * + * The signal option can be set to an AbortSignal to allow aborting an ongoing pipe operation via the corresponding AbortController. In this case, this source readable stream will be canceled, and destination aborted, unless the respective options preventCancel or preventAbort are set. + */ + preventClose?: boolean; + signal?: AbortSignal; +} + interface TextDecodeOptions { stream?: boolean; } @@ -1809,10 +1894,10 @@ interface TrackEventInit extends EventInit { } interface Transformer { - flush?: TransformStreamDefaultControllerCallback; + flush?: TransformerFlushCallback; readableType?: undefined; - start?: TransformStreamDefaultControllerCallback; - transform?: TransformStreamDefaultControllerTransformCallback; + start?: TransformerStartCallback; + transform?: TransformerTransformCallback; writableType?: undefined; } @@ -1832,26 +1917,18 @@ interface ULongRange { min?: number; } -interface UnderlyingByteSource { - autoAllocateChunkSize?: number; - cancel?: ReadableStreamErrorCallback; - pull?: ReadableByteStreamControllerCallback; - start?: ReadableByteStreamControllerCallback; - type: "bytes"; -} - interface UnderlyingSink { - abort?: WritableStreamErrorCallback; - close?: WritableStreamDefaultControllerCloseCallback; - start?: WritableStreamDefaultControllerStartCallback; + abort?: UnderlyingSinkAbortCallback; + close?: UnderlyingSinkCloseCallback; + start?: UnderlyingSinkStartCallback; type?: undefined; - write?: WritableStreamDefaultControllerWriteCallback; + write?: UnderlyingSinkWriteCallback; } interface UnderlyingSource { - cancel?: ReadableStreamErrorCallback; - pull?: ReadableStreamDefaultControllerCallback; - start?: ReadableStreamDefaultControllerCallback; + cancel?: UnderlyingSourceCancelCallback; + pull?: UnderlyingSourcePullCallback; + start?: UnderlyingSourceStartCallback; type?: undefined; } @@ -2340,7 +2417,9 @@ declare var AudioParamMap: { new(): AudioParamMap; }; -/** The Web Audio API events that occur when a ScriptProcessorNode input buffer is ready to be processed. */ +/** The Web Audio API events that occur when a ScriptProcessorNode input buffer is ready to be processed. + * @deprecated As of the August 29 2014 Web Audio API spec publication, this feature has been marked as deprecated, and is soon to be replaced by AudioWorklet. + */ interface AudioProcessingEvent extends Event { readonly inputBuffer: AudioBuffer; readonly outputBuffer: AudioBuffer; @@ -2583,13 +2662,13 @@ declare var BroadcastChannel: { /** This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams. */ interface ByteLengthQueuingStrategy extends QueuingStrategy { - highWaterMark: number; - size(chunk: ArrayBufferView): number; + readonly highWaterMark: number; + readonly size: QueuingStrategySize; } declare var ByteLengthQueuingStrategy: { prototype: ByteLengthQueuingStrategy; - new(options: { highWaterMark: number }): ByteLengthQueuingStrategy; + new(init: QueuingStrategyInit): ByteLengthQueuingStrategy; }; /** A CDATA section that can be used within XML to include extended portions of unescaped text. The symbols < and & don’t need escaping as they normally do when inside a CDATA section. */ @@ -3634,13 +3713,13 @@ declare var ConvolverNode: { /** This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams. */ interface CountQueuingStrategy extends QueuingStrategy { - highWaterMark: number; - size(chunk: any): 1; + readonly highWaterMark: number; + readonly size: QueuingStrategySize; } declare var CountQueuingStrategy: { prototype: CountQueuingStrategy; - new(options: { highWaterMark: number }): CountQueuingStrategy; + new(init: QueuingStrategyInit): CountQueuingStrategy; }; interface Credential { @@ -4700,6 +4779,7 @@ interface Document extends Node, DocumentAndElementEventHandlers, DocumentOrShad createEvent(eventInterface: "SVGZoomEvents"): SVGZoomEvent; createEvent(eventInterface: "SecurityPolicyViolationEvent"): SecurityPolicyViolationEvent; createEvent(eventInterface: "ServiceWorkerMessageEvent"): ServiceWorkerMessageEvent; + createEvent(eventInterface: "SpeechRecognitionErrorEvent"): SpeechRecognitionErrorEvent; createEvent(eventInterface: "SpeechRecognitionEvent"): SpeechRecognitionEvent; createEvent(eventInterface: "SpeechSynthesisErrorEvent"): SpeechSynthesisErrorEvent; createEvent(eventInterface: "SpeechSynthesisEvent"): SpeechSynthesisEvent; @@ -4767,8 +4847,8 @@ interface Document extends Node, DocumentAndElementEventHandlers, DocumentOrShad exitPointerLock(): void; getAnimations(): Animation[]; /** - * Returns a reference to the first object with the specified value of the ID or NAME attribute. - * @param elementId String that specifies the ID value. Case-insensitive. + * Returns a reference to the first object with the specified value of the ID attribute. + * @param elementId String that specifies the ID value. */ getElementById(elementId: string): HTMLElement | null; /** @@ -4949,6 +5029,7 @@ interface DocumentEvent { createEvent(eventInterface: "SVGZoomEvents"): SVGZoomEvent; createEvent(eventInterface: "SecurityPolicyViolationEvent"): SecurityPolicyViolationEvent; createEvent(eventInterface: "ServiceWorkerMessageEvent"): ServiceWorkerMessageEvent; + createEvent(eventInterface: "SpeechRecognitionErrorEvent"): SpeechRecognitionErrorEvent; createEvent(eventInterface: "SpeechRecognitionEvent"): SpeechRecognitionEvent; createEvent(eventInterface: "SpeechSynthesisErrorEvent"): SpeechSynthesisErrorEvent; createEvent(eventInterface: "SpeechSynthesisEvent"): SpeechSynthesisEvent; @@ -5077,7 +5158,6 @@ interface ElementEventMap { /** Element is the most general base class from which all objects in a Document inherit. It only has methods and properties common to all kinds of elements. More specific classes inherit from Element. */ interface Element extends Node, Animatable, ChildNode, InnerHTML, NonDocumentTypeChildNode, ParentNode, Slottable { - readonly assignedSlot: HTMLSlotElement | null; readonly attributes: NamedNodeMap; /** * Allows for manipulation of element's class content attribute as a set of whitespace-separated tokens through a DOMTokenList object. @@ -5632,24 +5712,7 @@ declare var GamepadPose: { }; interface GenericTransformStream { - /** - * Returns a readable stream whose chunks are strings resulting from running encoding's decoder on the chunks written to writable. - */ readonly readable: ReadableStream; - /** - * Returns a writable stream which accepts [AllowShared] BufferSource chunks and runs them through encoding's decoder before making them available to readable. - * - * Typically this will be used via the pipeThrough() method on a ReadableStream source. - * - * ``` - * var decoder = new TextDecoderStream(encoding); - * byteReadable - * .pipeThrough(decoder) - * .pipeTo(textWritable); - * ``` - * - * If the error mode is "fatal" and encoding's decoder returns error, both readable and writable will be errored with a TypeError. - */ readonly writable: WritableStream; } @@ -5713,6 +5776,7 @@ interface GlobalEventHandlersEventMap { "animationiteration": AnimationEvent; "animationstart": AnimationEvent; "auxclick": MouseEvent; + "beforeinput": InputEvent; "blur": FocusEvent; "cancel": Event; "canplay": Event; @@ -5720,6 +5784,9 @@ interface GlobalEventHandlersEventMap { "change": Event; "click": MouseEvent; "close": Event; + "compositionend": CompositionEvent; + "compositionstart": CompositionEvent; + "compositionupdate": CompositionEvent; "contextmenu": MouseEvent; "cuechange": Event; "dblclick": MouseEvent; @@ -7359,7 +7426,7 @@ interface HTMLInputElement extends HTMLElement { * @param end The offset into the text field for the end of the selection. * @param direction The direction in which the selection is performed. */ - setSelectionRange(start: number, end: number, direction?: "forward" | "backward" | "none"): void; + setSelectionRange(start: number | null, end: number | null, direction?: "forward" | "backward" | "none"): void; /** * Decrements a range input control's value by the value given by the Step attribute. If the optional parameter is used, it will decrement the input control's step value multiplied by the parameter's value. * @param n Value to decrement the value by. @@ -8655,7 +8722,6 @@ declare var HTMLTableElement: { }; interface HTMLTableHeaderCellElement extends HTMLTableCellElement { - scope: string; addEventListener(type: K, listener: (this: HTMLTableHeaderCellElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: K, listener: (this: HTMLTableHeaderCellElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void; @@ -8866,7 +8932,7 @@ interface HTMLTextAreaElement extends HTMLElement { * @param end The offset into the text field for the end of the selection. * @param direction The direction in which the selection is performed. */ - setSelectionRange(start: number, end: number, direction?: "forward" | "backward" | "none"): void; + setSelectionRange(start: number | null, end: number | null, direction?: "forward" | "backward" | "none"): void; addEventListener(type: K, listener: (this: HTMLTextAreaElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: K, listener: (this: HTMLTextAreaElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void; @@ -9633,7 +9699,7 @@ declare var InputEvent: { /** provides a way to asynchronously observe changes in the intersection of a target element with an ancestor element or with a top-level document's viewport. */ interface IntersectionObserver { - readonly root: Element | null; + readonly root: Element | Document | null; readonly rootMargin: string; readonly thresholds: ReadonlyArray; disconnect(): void; @@ -10572,7 +10638,8 @@ declare var MouseEvent: { new(type: string, eventInitDict?: MouseEventInit): MouseEvent; }; -/** Provides event properties that are specific to modifications to the Document Object Model (DOM) hierarchy and nodes. */ +/** Provides event properties that are specific to modifications to the Document Object Model (DOM) hierarchy and nodes. + * @deprecated DOM4 [DOM] provides a new mechanism using a MutationObserver interface which addresses the use cases that mutation events solve, but in a more performant manner. Thus, this specification describes mutation events for reference and completeness of legacy behavior, but deprecates the use of the MutationEvent interface. */ interface MutationEvent extends Event { readonly attrChange: number; readonly attrName: string; @@ -11050,7 +11117,6 @@ declare var NodeList: { }; interface NodeListOf extends NodeList { - length: number; item(index: number): TNode; /** * Performs the specified action for each node in an list. @@ -11559,7 +11625,9 @@ declare var PerformanceMeasure: { new(): PerformanceMeasure; }; -/** The legacy PerformanceNavigation interface represents information about how the navigation to the current document was done. */ +/** The legacy PerformanceNavigation interface represents information about how the navigation to the current document was done. + * @deprecated This interface is deprecated in the Navigation Timing Level 2 specification. Please use the PerformanceNavigationTiming interface instead. + */ interface PerformanceNavigation { readonly redirectCount: number; readonly type: number; @@ -11649,7 +11717,9 @@ declare var PerformanceResourceTiming: { new(): PerformanceResourceTiming; }; -/** A legacy interface kept for backwards compatibility and contains properties that offer performance timing information for various events which occur during the loading and use of the current page. You get a PerformanceTiming object describing your page using the window.performance.timing property. */ +/** A legacy interface kept for backwards compatibility and contains properties that offer performance timing information for various events which occur during the loading and use of the current page. You get a PerformanceTiming object describing your page using the window.performance.timing property. + * @deprecated This interface is deprecated in the Navigation Timing Level 2 specification. Please use the PerformanceNavigationTiming interface instead. + */ interface PerformanceTiming { readonly connectEnd: number; readonly connectStart: number; @@ -11792,6 +11862,8 @@ interface PointerEvent extends MouseEvent { readonly tiltY: number; readonly twist: number; readonly width: number; + getCoalescedEvents(): PointerEvent[]; + getPredictedEvents(): PointerEvent[]; } declare var PointerEvent: { @@ -12495,64 +12567,26 @@ declare var Range: { toString(): string; }; -interface ReadableByteStreamController { - readonly byobRequest: ReadableStreamBYOBRequest | undefined; - readonly desiredSize: number | null; - close(): void; - enqueue(chunk: ArrayBufferView): void; - error(error?: any): void; -} - -declare var ReadableByteStreamController: { - prototype: ReadableByteStreamController; - new(): ReadableByteStreamController; -}; - /** This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */ interface ReadableStream { readonly locked: boolean; cancel(reason?: any): Promise; - getReader(options: { mode: "byob" }): ReadableStreamBYOBReader; getReader(): ReadableStreamDefaultReader; - pipeThrough({ writable, readable }: { writable: WritableStream, readable: ReadableStream }, options?: PipeOptions): ReadableStream; - pipeTo(dest: WritableStream, options?: PipeOptions): Promise; + pipeThrough(transform: ReadableWritablePair, options?: StreamPipeOptions): ReadableStream; + pipeTo(dest: WritableStream, options?: StreamPipeOptions): Promise; tee(): [ReadableStream, ReadableStream]; } declare var ReadableStream: { prototype: ReadableStream; - new(underlyingSource: UnderlyingByteSource, strategy?: { highWaterMark?: number, size?: undefined }): ReadableStream; new(underlyingSource?: UnderlyingSource, strategy?: QueuingStrategy): ReadableStream; }; -interface ReadableStreamBYOBReader { - readonly closed: Promise; - cancel(reason?: any): Promise; - read(view: T): Promise>; - releaseLock(): void; -} - -declare var ReadableStreamBYOBReader: { - prototype: ReadableStreamBYOBReader; - new(): ReadableStreamBYOBReader; -}; - -interface ReadableStreamBYOBRequest { - readonly view: ArrayBufferView; - respond(bytesWritten: number): void; - respondWithNewView(view: ArrayBufferView): void; -} - -declare var ReadableStreamBYOBRequest: { - prototype: ReadableStreamBYOBRequest; - new(): ReadableStreamBYOBRequest; -}; - interface ReadableStreamDefaultController { readonly desiredSize: number | null; close(): void; enqueue(chunk: R): void; - error(error?: any): void; + error(e?: any): void; } declare var ReadableStreamDefaultController: { @@ -12560,29 +12594,21 @@ declare var ReadableStreamDefaultController: { new(): ReadableStreamDefaultController; }; -interface ReadableStreamDefaultReader { - readonly closed: Promise; - cancel(reason?: any): Promise; - read(): Promise>; +interface ReadableStreamDefaultReader extends ReadableStreamGenericReader { + read(): Promise>; releaseLock(): void; } declare var ReadableStreamDefaultReader: { prototype: ReadableStreamDefaultReader; - new(): ReadableStreamDefaultReader; + new(stream: ReadableStream): ReadableStreamDefaultReader; }; -interface ReadableStreamReader { - cancel(): Promise; - read(): Promise>; - releaseLock(): void; +interface ReadableStreamGenericReader { + readonly closed: Promise; + cancel(reason?: any): Promise; } -declare var ReadableStreamReader: { - prototype: ReadableStreamReader; - new(): ReadableStreamReader; -}; - /** This Fetch API interface represents a resource request. */ interface Request extends Body { /** @@ -12653,6 +12679,39 @@ declare var Request: { new(input: RequestInfo, init?: RequestInit): Request; }; +interface ResizeObserver { + disconnect(): void; + observe(target: Element, options?: ResizeObserverOptions): void; + unobserve(target: Element): void; +} + +declare var ResizeObserver: { + prototype: ResizeObserver; + new(callback: ResizeObserverCallback): ResizeObserver; +}; + +interface ResizeObserverEntry { + readonly borderBoxSize: ReadonlyArray; + readonly contentBoxSize: ReadonlyArray; + readonly contentRect: DOMRectReadOnly; + readonly target: Element; +} + +declare var ResizeObserverEntry: { + prototype: ResizeObserverEntry; + new(): ResizeObserverEntry; +}; + +interface ResizeObserverSize { + readonly blockSize: number; + readonly inlineSize: number; +} + +declare var ResizeObserverSize: { + prototype: ResizeObserverSize; + new(): ResizeObserverSize; +}; + /** This Fetch API interface represents the response to a request. */ interface Response extends Body { readonly headers: Headers; @@ -14477,7 +14536,7 @@ declare var SVGStringList: { }; /** Corresponds to the SVG