feat: update to TypeScript 4.0 (#6514)

This commit is contained in:
Kitson Kelly 2020-08-25 09:43:54 +10:00 committed by GitHub
parent 9b0f9c8765
commit c4d5b01acf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
58 changed files with 30837 additions and 24467 deletions

View File

@ -12,7 +12,9 @@
],
"rules": {
"@typescript-eslint/array-type": ["error", { "default": "array-simple" }],
"@typescript-eslint/ban-ts-comment": ["off"],
"@typescript-eslint/explicit-member-accessibility": ["off"],
"@typescript-eslint/explicit-module-boundary-types": ["off"],
"@typescript-eslint/no-non-null-assertion": ["off"],
"@typescript-eslint/no-use-before-define": ["off"],
"@typescript-eslint/no-parameter-properties": ["off"],

116
cli/dts/lib.dom.d.ts vendored
View File

@ -825,8 +825,8 @@ interface MediaTrackSupportedConstraints {
width?: boolean;
}
interface MessageEventInit extends EventInit {
data?: any;
interface MessageEventInit<T = any> extends EventInit {
data?: T;
lastEventId?: string;
origin?: string;
ports?: MessagePort[];
@ -2978,6 +2978,11 @@ interface CSSStyleDeclaration {
overflowWrap: string;
overflowX: string;
overflowY: string;
overscrollBehavior: string;
overscrollBehaviorBlock: string;
overscrollBehaviorInline: string;
overscrollBehaviorX: string;
overscrollBehaviorY: string;
padding: string;
paddingBlockEnd: string;
paddingBlockStart: string;
@ -3938,7 +3943,16 @@ declare var DOMMatrixReadOnly: {
/** Provides the ability to parse XML or HTML source code from a string into a DOM Document. */
interface DOMParser {
parseFromString(str: string, type: SupportedType): Document;
/**
* Parses string using either the HTML or XML parser, according to type, and returns the resulting Document. type can be "text/html" (which will invoke the HTML parser), or any of "text/xml", "application/xml", "application/xhtml+xml", or "image/svg+xml" (which will invoke the XML parser).
*
* For the XML parser, if string cannot be parsed, then the returned Document will contain elements describing the resulting error.
*
* Note that script elements are not evaluated during parsing, and the resulting document's encoding will always be UTF-8.
*
* Values other than the above for type will cause a TypeError exception to be thrown.
*/
parseFromString(string: string, type: DOMParserSupportedType): Document;
}
declare var DOMParser: {
@ -4549,10 +4563,6 @@ interface Document extends Node, DocumentAndElementEventHandlers, DocumentOrShad
*/
onreadystatechange: ((this: Document, ev: Event) => any) | null;
onvisibilitychange: ((this: Document, ev: Event) => any) | null;
/**
* Returns document's origin.
*/
readonly origin: string;
readonly ownerDocument: null;
/**
* Return an HTMLCollection of the embed elements in the Document.
@ -5085,7 +5095,7 @@ 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, Slotable {
interface Element extends Node, Animatable, ChildNode, InnerHTML, NonDocumentTypeChildNode, ParentNode, Slottable {
readonly assignedSlot: HTMLSlotElement | null;
readonly attributes: NamedNodeMap;
/**
@ -5252,6 +5262,7 @@ interface ElementCSSInlineStyle {
interface ElementContentEditable {
contentEditable: string;
enterKeyHint: string;
inputMode: string;
readonly isContentEditable: boolean;
}
@ -7084,6 +7095,7 @@ interface HTMLImageElement extends HTMLElement {
* Sets or retrieves whether the image is a server-side image map.
*/
isMap: boolean;
loading: string;
/**
* Sets or retrieves a Uniform Resource Identifier (URI) to a long description of the object.
*/
@ -10404,11 +10416,11 @@ declare var MessageChannel: {
};
/** A message received by a target object. */
interface MessageEvent extends Event {
interface MessageEvent<T = any> extends Event {
/**
* Returns the data of the message.
*/
readonly data: any;
readonly data: T;
/**
* Returns the last event ID string, for server-sent events.
*/
@ -10429,7 +10441,7 @@ interface MessageEvent extends Event {
declare var MessageEvent: {
prototype: MessageEvent;
new(type: string, eventInitDict?: MessageEventInit): MessageEvent;
new<T>(type: string, eventInitDict?: MessageEventInit<T>): MessageEvent<T>;
};
interface MessagePortEventMap {
@ -14357,8 +14369,8 @@ interface SVGSVGElement extends SVGGraphicsElement, DocumentEvent, SVGFitToViewB
getComputedStyle(elt: Element, pseudoElt?: string | null): CSSStyleDeclaration;
getCurrentTime(): number;
getElementById(elementId: string): Element;
getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeListOf<SVGCircleElement | SVGEllipseElement | SVGImageElement | SVGLineElement | SVGPathElement | SVGPolygonElement | SVGPolylineElement | SVGRectElement | SVGTextElement | SVGUseElement>;
getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeListOf<SVGCircleElement | SVGEllipseElement | SVGImageElement | SVGLineElement | SVGPathElement | SVGPolygonElement | SVGPolylineElement | SVGRectElement | SVGTextElement | SVGUseElement>;
getEnclosureList(rect: SVGRect, referenceElement: SVGElement | null): NodeListOf<SVGCircleElement | SVGEllipseElement | SVGImageElement | SVGLineElement | SVGPathElement | SVGPolygonElement | SVGPolylineElement | SVGRectElement | SVGTextElement | SVGUseElement>;
getIntersectionList(rect: SVGRect, referenceElement: SVGElement | null): NodeListOf<SVGCircleElement | SVGEllipseElement | SVGImageElement | SVGLineElement | SVGPathElement | SVGPolygonElement | SVGPolylineElement | SVGRectElement | SVGTextElement | SVGUseElement>;
pauseAnimations(): void;
setCurrentTime(seconds: number): void;
/** @deprecated */
@ -14981,7 +14993,7 @@ declare var SharedWorker: {
new(scriptURL: string, options?: string | WorkerOptions): SharedWorker;
};
interface Slotable {
interface Slottable {
readonly assignedSlot: HTMLSlotElement | null;
}
@ -15069,7 +15081,7 @@ interface SpeechRecognitionEventMap {
"audioend": Event;
"audiostart": Event;
"end": Event;
"error": Event;
"error": ErrorEvent;
"nomatch": SpeechRecognitionEvent;
"result": SpeechRecognitionEvent;
"soundend": Event;
@ -15088,7 +15100,7 @@ interface SpeechRecognition extends EventTarget {
onaudioend: ((this: SpeechRecognition, ev: Event) => any) | null;
onaudiostart: ((this: SpeechRecognition, ev: Event) => any) | null;
onend: ((this: SpeechRecognition, ev: Event) => any) | null;
onerror: ((this: SpeechRecognition, ev: Event) => any) | null;
onerror: ((this: SpeechRecognition, ev: ErrorEvent) => any) | null;
onnomatch: ((this: SpeechRecognition, ev: SpeechRecognitionEvent) => any) | null;
onresult: ((this: SpeechRecognition, ev: SpeechRecognitionEvent) => any) | null;
onsoundend: ((this: SpeechRecognition, ev: Event) => any) | null;
@ -15386,24 +15398,24 @@ declare var StyleSheetList: {
/** 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). */
interface SubtleCrypto {
decrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer): PromiseLike<ArrayBuffer>;
deriveBits(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, length: number): PromiseLike<ArrayBuffer>;
deriveKey(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: string | AesDerivedKeyParams | HmacImportParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, extractable: boolean, keyUsages: KeyUsage[]): PromiseLike<CryptoKey>;
digest(algorithm: AlgorithmIdentifier, data: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer): PromiseLike<ArrayBuffer>;
encrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer): PromiseLike<ArrayBuffer>;
exportKey(format: "jwk", key: CryptoKey): PromiseLike<JsonWebKey>;
exportKey(format: "raw" | "pkcs8" | "spki", key: CryptoKey): PromiseLike<ArrayBuffer>;
exportKey(format: string, key: CryptoKey): PromiseLike<JsonWebKey | ArrayBuffer>;
generateKey(algorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: KeyUsage[]): PromiseLike<CryptoKeyPair | CryptoKey>;
generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams | DhKeyGenParams, extractable: boolean, keyUsages: KeyUsage[]): PromiseLike<CryptoKeyPair>;
generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: KeyUsage[]): PromiseLike<CryptoKey>;
importKey(format: "jwk", keyData: JsonWebKey, algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): PromiseLike<CryptoKey>;
importKey(format: "raw" | "pkcs8" | "spki", keyData: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer, algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): PromiseLike<CryptoKey>;
importKey(format: string, keyData: JsonWebKey | Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer, algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): PromiseLike<CryptoKey>;
sign(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, data: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer): PromiseLike<ArrayBuffer>;
unwrapKey(format: "raw" | "pkcs8" | "spki" | "jwk" | string, wrappedKey: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, unwrappedKeyAlgorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): PromiseLike<CryptoKey>;
verify(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, signature: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer, data: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer): PromiseLike<boolean>;
wrapKey(format: "raw" | "pkcs8" | "spki" | "jwk" | string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams): PromiseLike<ArrayBuffer>;
decrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer): Promise<ArrayBuffer>;
deriveBits(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, length: number): Promise<ArrayBuffer>;
deriveKey(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: string | AesDerivedKeyParams | HmacImportParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
digest(algorithm: AlgorithmIdentifier, data: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer): Promise<ArrayBuffer>;
encrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer): Promise<ArrayBuffer>;
exportKey(format: "jwk", key: CryptoKey): Promise<JsonWebKey>;
exportKey(format: "raw" | "pkcs8" | "spki", key: CryptoKey): Promise<ArrayBuffer>;
exportKey(format: string, key: CryptoKey): Promise<JsonWebKey | ArrayBuffer>;
generateKey(algorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKeyPair | CryptoKey>;
generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams | DhKeyGenParams, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKeyPair>;
generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
importKey(format: "jwk", keyData: JsonWebKey, algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
importKey(format: "raw" | "pkcs8" | "spki", keyData: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer, algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
importKey(format: string, keyData: JsonWebKey | Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer, algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
sign(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, data: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer): Promise<ArrayBuffer>;
unwrapKey(format: "raw" | "pkcs8" | "spki" | "jwk" | string, wrappedKey: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, unwrappedKeyAlgorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
verify(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, signature: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer, data: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer): Promise<boolean>;
wrapKey(format: "raw" | "pkcs8" | "spki" | "jwk" | string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams): Promise<ArrayBuffer>;
}
declare var SubtleCrypto: {
@ -15423,7 +15435,7 @@ declare var SyncManager: {
};
/** The textual content of Element or Attr. If an element has no markup within its content, it has a single child implementing Text that contains the element's text. However, if the element contains markup, it is parsed into information items and Text nodes that form its children. */
interface Text extends CharacterData, Slotable {
interface Text extends CharacterData, Slottable {
readonly assignedSlot: HTMLSlotElement | null;
/**
* Returns the combined data of all direct Text node siblings.
@ -16166,6 +16178,32 @@ declare var VideoPlaybackQuality: {
new(): VideoPlaybackQuality;
};
interface VisualViewportEventMap {
"resize": UIEvent;
"scroll": Event;
}
interface VisualViewport extends EventTarget {
readonly height: number;
readonly offsetLeft: number;
readonly offsetTop: number;
onresize: ((this: VisualViewport, ev: UIEvent) => any) | null;
onscroll: ((this: VisualViewport, ev: Event) => any) | null;
readonly pageLeft: number;
readonly pageTop: number;
readonly scale: number;
readonly width: number;
addEventListener<K extends keyof VisualViewportEventMap>(type: K, listener: (this: VisualViewport, ev: VisualViewportEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof VisualViewportEventMap>(type: K, listener: (this: VisualViewport, ev: VisualViewportEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
}
declare var VisualViewport: {
prototype: VisualViewport;
new(): VisualViewport;
};
interface WEBGL_color_buffer_float {
readonly FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT: GLenum;
readonly RGBA32F_EXT: GLenum;
@ -18474,6 +18512,7 @@ interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandler
readonly styleMedia: StyleMedia;
readonly toolbar: BarProp;
readonly top: Window;
readonly visualViewport: VisualViewport;
readonly window: Window & typeof globalThis;
alert(message?: any): void;
blur(): void;
@ -18497,7 +18536,7 @@ interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandler
/** @deprecated */
releaseEvents(): void;
resizeBy(x: number, y: number): void;
resizeTo(x: number, y: number): void;
resizeTo(width: number, height: number): void;
scroll(options?: ScrollToOptions): void;
scroll(x: number, y: number): void;
scrollBy(options?: ScrollToOptions): void;
@ -19502,6 +19541,7 @@ declare var statusbar: BarProp;
declare var styleMedia: StyleMedia;
declare var toolbar: BarProp;
declare var top: Window;
declare var visualViewport: VisualViewport;
declare var window: Window & typeof globalThis;
declare function alert(message?: any): void;
declare function blur(): void;
@ -19525,7 +19565,7 @@ declare function prompt(message?: string, _default?: string): string | null;
/** @deprecated */
declare function releaseEvents(): void;
declare function resizeBy(x: number, y: number): void;
declare function resizeTo(x: number, y: number): void;
declare function resizeTo(width: number, height: number): void;
declare function scroll(options?: ScrollToOptions): void;
declare function scroll(x: number, y: number): void;
declare function scrollBy(options?: ScrollToOptions): void;
@ -19936,6 +19976,7 @@ type ColorSpaceConversion = "default" | "none";
type CompositeOperation = "accumulate" | "add" | "replace";
type CompositeOperationOrAuto = "accumulate" | "add" | "auto" | "replace";
type CredentialMediationRequirement = "optional" | "required" | "silent";
type DOMParserSupportedType = "application/xhtml+xml" | "application/xml" | "image/svg+xml" | "text/html" | "text/xml";
type DirectionSetting = "" | "lr" | "rl";
type DisplayCaptureSurfaceType = "application" | "browser" | "monitor" | "window";
type DistanceModelType = "exponential" | "inverse" | "linear";
@ -20036,7 +20077,6 @@ type ServiceWorkerState = "activated" | "activating" | "installed" | "installing
type ServiceWorkerUpdateViaCache = "all" | "imports" | "none";
type ShadowRootMode = "closed" | "open";
type SpeechSynthesisErrorCode = "audio-busy" | "audio-hardware" | "canceled" | "interrupted" | "invalid-argument" | "language-unavailable" | "network" | "not-allowed" | "synthesis-failed" | "synthesis-unavailable" | "text-too-long" | "voice-unavailable";
type SupportedType = "application/xhtml+xml" | "application/xml" | "image/svg+xml" | "text/html" | "text/xml";
type TextTrackKind = "captions" | "chapters" | "descriptions" | "metadata" | "subtitles";
type TextTrackMode = "disabled" | "hidden" | "showing";
type TouchType = "direct" | "stylus";

View File

@ -454,48 +454,48 @@ interface String {
startsWith(searchString: string, position?: number): boolean;
/**
* Returns an <a> HTML anchor element and sets the name attribute to the text value
* Returns an `<a>` HTML anchor element and sets the name attribute to the text value
* @param name
*/
anchor(name: string): string;
/** Returns a <big> HTML element */
/** Returns a `<big>` HTML element */
big(): string;
/** Returns a <blink> HTML element */
/** Returns a `<blink>` HTML element */
blink(): string;
/** Returns a <b> HTML element */
/** Returns a `<b>` HTML element */
bold(): string;
/** Returns a <tt> HTML element */
/** Returns a `<tt>` HTML element */
fixed(): string;
/** Returns a <font> HTML element and sets the color attribute value */
/** Returns a `<font>` HTML element and sets the color attribute value */
fontcolor(color: string): string;
/** Returns a <font> HTML element and sets the size attribute value */
/** Returns a `<font>` HTML element and sets the size attribute value */
fontsize(size: number): string;
/** Returns a <font> HTML element and sets the size attribute value */
/** Returns a `<font>` HTML element and sets the size attribute value */
fontsize(size: string): string;
/** Returns an <i> HTML element */
/** Returns an `<i>` HTML element */
italics(): string;
/** Returns an <a> HTML element and sets the href attribute value */
/** Returns an `<a>` HTML element and sets the href attribute value */
link(url: string): string;
/** Returns a <small> HTML element */
/** Returns a `<small>` HTML element */
small(): string;
/** Returns a <strike> HTML element */
/** Returns a `<strike>` HTML element */
strike(): string;
/** Returns a <sub> HTML element */
/** Returns a `<sub>` HTML element */
sub(): string;
/** Returns a <sup> HTML element */
/** Returns a `<sup>` HTML element */
sup(): string;
}

View File

@ -122,8 +122,11 @@ interface Atomics {
/**
* Wakes up sleeping agents that are waiting on the given index of the array, returning the
* number of agents that were awoken.
* @param typedArray A shared Int32Array.
* @param index The position in the typedArray to wake up on.
* @param count The number of sleeping agents to notify. Defaults to +Infinity.
*/
notify(typedArray: Int32Array, index: number, count: number): number;
notify(typedArray: Int32Array, index: number, count?: number): number;
/**
* Stores the bitwise XOR of a value with the value at the given position in the array,

View File

@ -18,6 +18,92 @@ and limitations under the License.
/// <reference no-default-lib="true"/>
interface BigIntToLocaleStringOptions {
/**
* The locale matching algorithm to use.The default is "best fit". For information about this option, see the {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation Intl page}.
*/
localeMatcher?: string;
/**
* The formatting style to use , the default is "decimal".
*/
style?: string;
numberingSystem?: string;
/**
* The unit to use in unit formatting, Possible values are core unit identifiers, defined in UTS #35, Part 2, Section 6. A subset of units from the full list was selected for use in ECMAScript. Pairs of simple units can be concatenated with "-per-" to make a compound unit. There is no default value; if the style is "unit", the unit property must be provided.
*/
unit?: string;
/**
* The unit formatting style to use in unit formatting, the defaults is "short".
*/
unitDisplay?: string;
/**
* The currency to use in currency formatting. Possible values are the ISO 4217 currency codes, such as "USD" for the US dollar, "EUR" for the euro, or "CNY" for the Chinese RMB see the Current currency & funds code list. There is no default value; if the style is "currency", the currency property must be provided. It is only used when [[Style]] has the value "currency".
*/
currency?: string;
/**
* How to display the currency in currency formatting. It is only used when [[Style]] has the value "currency". The default is "symbol".
*
* "symbol" to use a localized currency symbol such as ,
*
* "code" to use the ISO currency code,
*
* "name" to use a localized currency name such as "dollar"
*/
currencyDisplay?: string;
/**
* Whether to use grouping separators, such as thousands separators or thousand/lakh/crore separators. The default is true.
*/
useGrouping?: boolean;
/**
* The minimum number of integer digits to use. Possible values are from 1 to 21; the default is 1.
*/
minimumIntegerDigits?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21;
/**
* The minimum number of fraction digits to use. Possible values are from 0 to 20; the default for plain number and percent formatting is 0; the default for currency formatting is the number of minor unit digits provided by the {@link http://www.currency-iso.org/en/home/tables/table-a1.html ISO 4217 currency codes list} (2 if the list doesn't provide that information).
*/
minimumFractionDigits?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20;
/**
* The maximum number of fraction digits to use. Possible values are from 0 to 20; the default for plain number formatting is the larger of minimumFractionDigits and 3; the default for currency formatting is the larger of minimumFractionDigits and the number of minor unit digits provided by the {@link http://www.currency-iso.org/en/home/tables/table-a1.html ISO 4217 currency codes list} (2 if the list doesn't provide that information); the default for percent formatting is the larger of minimumFractionDigits and 0.
*/
maximumFractionDigits?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20;
/**
* The minimum number of significant digits to use. Possible values are from 1 to 21; the default is 1.
*/
minimumSignificantDigits?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21;
/**
* The maximum number of significant digits to use. Possible values are from 1 to 21; the default is 21.
*/
maximumSignificantDigits?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21;
/**
* The formatting that should be displayed for the number, the defaults is "standard"
*
* "standard" plain number formatting
*
* "scientific" return the order-of-magnitude for formatted number.
*
* "engineering" return the exponent of ten when divisible by three
*
* "compact" string representing exponent, defaults is using the "short" form
*/
notation?: string;
/**
* used only when notation is "compact"
*/
compactDisplay?: string;
}
interface BigInt {
/**
* Returns a string representation of an object.
@ -26,7 +112,7 @@ interface BigInt {
toString(radix?: number): string;
/** Returns a string representation appropriate to the host environment's current locale. */
toLocaleString(): string;
toLocaleString(locales?: string, options?: BigIntToLocaleStringOptions): string;
/** Returns the primitive value of the specified object. */
valueOf(): bigint;
@ -89,13 +175,13 @@ interface BigInt64Array {
/**
* Determines whether all the members of an array satisfy the specified test.
* @param callbackfn A function that accepts up to three arguments. The every method calls
* the callbackfn function for each element in the array until the callbackfn returns false,
* @param predicate A function that accepts up to three arguments. The every method calls
* the predicate function for each element in the array until the predicate returns false,
* or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
every(callbackfn: (value: bigint, index: number, array: BigInt64Array) => boolean, thisArg?: any): boolean;
every(predicate: (value: bigint, index: number, array: BigInt64Array) => boolean, thisArg?: any): boolean;
/**
* Returns the this object after filling the section identified by start and end with value
@ -109,12 +195,12 @@ interface BigInt64Array {
/**
* Returns the elements of an array that meet the condition specified in a callback function.
* @param callbackfn A function that accepts up to three arguments. The filter method calls
* the callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param predicate A function that accepts up to three arguments. The filter method calls
* the predicate function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
filter(callbackfn: (value: bigint, index: number, array: BigInt64Array) => any, thisArg?: any): BigInt64Array;
filter(predicate: (value: bigint, index: number, array: BigInt64Array) => any, thisArg?: any): BigInt64Array;
/**
* Returns the value of the first element in the array where predicate is true, and undefined
@ -260,13 +346,13 @@ interface BigInt64Array {
/**
* Determines whether the specified callback function returns true for any element of an array.
* @param callbackfn A function that accepts up to three arguments. The some method calls the
* callbackfn function for each element in the array until the callbackfn returns true, or until
* @param predicate A function that accepts up to three arguments. The some method calls the
* predicate function for each element in the array until the predicate returns true, or until
* the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
some(callbackfn: (value: bigint, index: number, array: BigInt64Array) => boolean, thisArg?: any): boolean;
some(predicate: (value: bigint, index: number, array: BigInt64Array) => boolean, thisArg?: any): boolean;
/**
* Sorts the array.
@ -361,13 +447,13 @@ interface BigUint64Array {
/**
* Determines whether all the members of an array satisfy the specified test.
* @param callbackfn A function that accepts up to three arguments. The every method calls
* the callbackfn function for each element in the array until the callbackfn returns false,
* @param predicate A function that accepts up to three arguments. The every method calls
* the predicate function for each element in the array until the predicate returns false,
* or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
every(callbackfn: (value: bigint, index: number, array: BigUint64Array) => boolean, thisArg?: any): boolean;
every(predicate: (value: bigint, index: number, array: BigUint64Array) => boolean, thisArg?: any): boolean;
/**
* Returns the this object after filling the section identified by start and end with value
@ -381,12 +467,12 @@ interface BigUint64Array {
/**
* Returns the elements of an array that meet the condition specified in a callback function.
* @param callbackfn A function that accepts up to three arguments. The filter method calls
* the callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param predicate A function that accepts up to three arguments. The filter method calls
* the predicate function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
filter(callbackfn: (value: bigint, index: number, array: BigUint64Array) => any, thisArg?: any): BigUint64Array;
filter(predicate: (value: bigint, index: number, array: BigUint64Array) => any, thisArg?: any): BigUint64Array;
/**
* Returns the value of the first element in the array where predicate is true, and undefined
@ -532,13 +618,13 @@ interface BigUint64Array {
/**
* Determines whether the specified callback function returns true for any element of an array.
* @param callbackfn A function that accepts up to three arguments. The some method calls the
* callbackfn function for each element in the array until the callbackfn returns true, or until
* @param predicate A function that accepts up to three arguments. The some method calls the
* predicate function for each element in the array until the predicate returns true, or until
* the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
some(callbackfn: (value: bigint, index: number, array: BigUint64Array) => boolean, thisArg?: any): boolean;
some(predicate: (value: bigint, index: number, array: BigUint64Array) => boolean, thisArg?: any): boolean;
/**
* Sorts the array.
@ -633,3 +719,10 @@ interface DataView {
*/
setBigUint64(byteOffset: number, value: bigint, littleEndian?: boolean): void;
}
declare namespace Intl{
interface NumberFormat {
format(value: number | bigint): string;
resolvedOptions(): ResolvedNumberFormatOptions;
}
}

View File

@ -23,3 +23,4 @@ and limitations under the License.
/// <reference lib="es2020.promise" />
/// <reference lib="es2020.string" />
/// <reference lib="es2020.symbol.wellknown" />
/// <reference lib="es2020.intl" />

296
cli/dts/lib.es2020.intl.d.ts vendored Normal file
View File

@ -0,0 +1,296 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
declare namespace Intl {
/**
* [BCP 47 language tag](http://tools.ietf.org/html/rfc5646) definition.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument).
*
* [Wikipedia](https://en.wikipedia.org/wiki/IETF_language_tag).
*/
type BCP47LanguageTag = string;
/**
* Unit to use in the relative time internationalized message.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/format#Parameters).
*
* [Specification](https://tc39.es/ecma402/#sec-singularrelativetimeunit).
*/
type RelativeTimeFormatUnit =
| "year" | "years"
| "quarter" | "quarters"
| "month" | "months"
| "week" | "weeks"
| "day" | "days"
| "hour" | "hours"
| "minute" | "minutes"
| "second" | "seconds"
;
/**
* The locale matching algorithm to use.
*
* [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation).
*
* [Specification](https://tc39.es/ecma402/#sec-InitializeRelativeTimeFormat).
*/
type RelativeTimeFormatLocaleMatcher = "lookup" | "best fit";
/**
* The format of output message.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters).
*
* [Specification](https://tc39.es/ecma402/#sec-InitializeRelativeTimeFormat).
*/
type RelativeTimeFormatNumeric = "always" | "auto";
/**
* The length of the internationalized message.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters).
*
* [Specification](https://tc39.es/ecma402/#sec-InitializeRelativeTimeFormat).
*/
type RelativeTimeFormatStyle = "long" | "short" | "narrow";
/**
* An object with some or all of properties of `options` parameter
* of `Intl.RelativeTimeFormat` constructor.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters).
*
* [Specification](https://tc39.es/ecma402/#sec-InitializeRelativeTimeFormat).
*/
interface RelativeTimeFormatOptions {
localeMatcher?: RelativeTimeFormatLocaleMatcher;
numeric?: RelativeTimeFormatNumeric;
style?: RelativeTimeFormatStyle;
}
/**
* An object with properties reflecting the locale
* and formatting options computed during initialization
* of the `Intel.RelativeTimeFormat` object
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/resolvedOptions#Description).
*
* [Specification](https://tc39.es/ecma402/#table-relativetimeformat-resolvedoptions-properties)
*/
interface ResolvedRelativeTimeFormatOptions {
locale: BCP47LanguageTag;
style: RelativeTimeFormatStyle;
numeric: RelativeTimeFormatNumeric;
numberingSystem: string;
}
/**
* An object representing the relative time format in parts
* that can be used for custom locale-aware formatting.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/formatToParts#Using_formatToParts).
*
* [Specification](https://tc39.es/ecma402/#sec-FormatRelativeTimeToParts).
*/
interface RelativeTimeFormatPart {
type: string;
value: string;
unit?: RelativeTimeFormatUnit;
}
interface RelativeTimeFormat {
/**
* Formats a value and a unit according to the locale
* and formatting options of the given
* [`Intl.RelativeTimeFormat`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat)
* object.
*
* While this method automatically provides the correct plural forms,
* the grammatical form is otherwise as neutral as possible.
* It is the caller's responsibility to handle cut-off logic
* such as deciding between displaying "in 7 days" or "in 1 week".
* This API does not support relative dates involving compound units.
* e.g "in 5 days and 4 hours".
*
* @param value - Numeric value to use in the internationalized relative time message
*
* @param unit - [Unit](https://tc39.es/ecma402/#sec-singularrelativetimeunit)
* to use in the relative time internationalized message.
* Possible values are: `"year"`, `"quarter"`, `"month"`, `"week"`,
* `"day"`, `"hour"`, `"minute"`, `"second"`.
* Plural forms are also permitted.
*
* @throws `RangeError` if `unit` was given something other than `unit` possible values
*
* @returns Internationalized relative time message as string
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/format).
*
* [Specification](https://tc39.es/ecma402/#sec-Intl.RelativeTimeFormat.prototype.format).
*/
format(
value: number,
unit: RelativeTimeFormatUnit,
): string;
/**
* A version of the format method which it returns an array of objects
* which represent "parts" of the object,
* separating the formatted number into its constituent parts
* and separating it from other surrounding text.
* These objects have two properties:
* `type` a NumberFormat formatToParts type, and `value`,
* which is the String which is the component of the output.
* If a "part" came from NumberFormat,
* it will have a unit property which indicates the `unit` being formatted;
* literals which are part of the larger frame will not have this property.
*
* @param value - Numeric value to use in the internationalized relative time message
*
* @param unit - [Unit](https://tc39.es/ecma402/#sec-singularrelativetimeunit)
* to use in the relative time internationalized message.
* Possible values are: `"year"`, `"quarter"`, `"month"`, `"week"`,
* `"day"`, `"hour"`, `"minute"`, `"second"`.
* Plural forms are also permitted.
*
* @throws `RangeError` if `unit` was given something other than `unit` possible values
*
* @returns Array of [FormatRelativeTimeToParts](https://tc39.es/ecma402/#sec-FormatRelativeTimeToParts)
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/formatToParts).
*
* [Specification](https://tc39.es/ecma402/#sec-Intl.RelativeTimeFormat.prototype.formatToParts).
*/
formatToParts(
value: number,
unit: RelativeTimeFormatUnit,
): RelativeTimeFormatPart[];
/**
* Provides access to the locale and options computed during initialization of this `Intl.RelativeTimeFormat` object.
*
* @returns A new object with properties reflecting the locale
* and formatting options computed during initialization
* of the `Intel.RelativeTimeFormat` object.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/resolvedOptions).
*
* [Specification](https://tc39.es/ecma402/#sec-intl.relativetimeformat.prototype.resolvedoptions)
*/
resolvedOptions(): ResolvedRelativeTimeFormatOptions;
}
/**
* The [`Intl.RelativeTimeFormat`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat)
* object is a constructor for objects that enable language-sensitive relative time formatting.
*
* Part of [Intl object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl)
* namespace and the [ECMAScript Internationalization API](https://www.ecma-international.org/publications/standards/Ecma-402.htm).
*
* [Compatibility](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat#Browser_compatibility).
*
* [Polyfills](https://github.com/tc39/proposal-intl-relative-time#polyfills).
*/
const RelativeTimeFormat: {
/**
* Constructor creates [Intl.RelativeTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat)
* objects
*
* @param locales - A string with a [BCP 47 language tag](http://tools.ietf.org/html/rfc5646), or an array of such strings.
* For the general form and interpretation of the locales argument,
* see the [`Intl` page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).
*
* @param options - An [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters)
* with some or all of options of the formatting.
* An object with some or all of the following properties:
* - `localeMatcher` - The locale matching algorithm to use.
* Possible values are `"lookup"` and `"best fit"`; the default is `"best fit"`.
* For information about this option, see [Intl page](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation).
* - `numeric` - The format of output message.
* Possible values are: `"always"` (default, e.g., `1 day ago`) or `"auto"` (e.g., `yesterday`).
* The `"auto"` value allows to not always have to use numeric values in the output.
* - `style` - The length of the internationalized message. Possible values are:
* `"long"` (default, e.g., in 1 month),
* `"short"` (e.g., in 1 mo.)
* or `"narrow"` (e.g., in 1 mo.). The narrow style could be similar to the short style for some locales.
*
* @returns [Intl.RelativeTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat) object.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat).
*
* [Specification](https://tc39.es/ecma402/#sec-intl-relativetimeformat-constructor).
*/
new(
locales?: BCP47LanguageTag | BCP47LanguageTag[],
options?: RelativeTimeFormatOptions,
): RelativeTimeFormat;
/**
* Returns an array containing those of the provided locales
* that are supported in date and time formatting
* without having to fall back to the runtime's default locale.
*
* @param locales - A string with a [BCP 47 language tag](http://tools.ietf.org/html/rfc5646), or an array of such strings.
* For the general form and interpretation of the locales argument,
* see the [`Intl` page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).
*
* @param options - An [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat#Parameters)
* with some or all of options of the formatting.
* An object with some or all of the following properties:
* - `localeMatcher` - The locale matching algorithm to use.
* Possible values are `"lookup"` and `"best fit"`; the default is `"best fit"`.
* For information about this option, see [Intl page](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation).
* - `numeric` - The format of output message.
* Possible values are: `"always"` (default, e.g., `1 day ago`) or `"auto"` (e.g., `yesterday`).
* The `"auto"` value allows to not always have to use numeric values in the output.
* - `style` - The length of the internationalized message. Possible values are:
* `"long"` (default, e.g., in 1 month),
* `"short"` (e.g., in 1 mo.)
* or `"narrow"` (e.g., in 1 mo.). The narrow style could be similar to the short style for some locales.
*
* @returns An array containing those of the provided locales
* that are supported in date and time formatting
* without having to fall back to the runtime's default locale.
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/supportedLocalesOf).
*
* [Specification](https://tc39.es/ecma402/#sec-Intl.RelativeTimeFormat.supportedLocalesOf).
*/
supportedLocalesOf(
locales: BCP47LanguageTag | BCP47LanguageTag[],
options?: RelativeTimeFormatOptions,
): BCP47LanguageTag[];
};
interface NumberFormatOptions {
notation?: string;
unit?: string;
unitDisplay?: string;
}
interface ResolvedNumberFormatOptions {
notation?: string;
unit?: string;
unitDisplay?: string;
}
}

326
cli/dts/lib.es5.d.ts vendored
View File

@ -1131,22 +1131,31 @@ interface ReadonlyArray<T> {
lastIndexOf(searchElement: T, fromIndex?: number): number;
/**
* Determines whether all the members of an array satisfy the specified test.
* @param callbackfn A function that accepts up to three arguments. The every method calls
* the callbackfn function for each element in the array until the callbackfn returns a value
* @param predicate A function that accepts up to three arguments. The every method calls
* the predicate function for each element in the array until the predicate returns a value
* which is coercible to the Boolean value false, or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
every(callbackfn: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): boolean;
every<S extends T>(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): this is readonly S[];
/**
* Determines whether all the members of an array satisfy the specified test.
* @param predicate A function that accepts up to three arguments. The every method calls
* the predicate function for each element in the array until the predicate returns a value
* which is coercible to the Boolean value false, or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
every(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): boolean;
/**
* Determines whether the specified callback function returns true for any element of an array.
* @param callbackfn A function that accepts up to three arguments. The some method calls
* the callbackfn function for each element in the array until the callbackfn returns a value
* @param predicate A function that accepts up to three arguments. The some method calls
* the predicate function for each element in the array until the predicate returns a value
* which is coercible to the Boolean value true, or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
some(callbackfn: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): boolean;
some(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): boolean;
/**
* Performs the specified action for each element in an array.
* @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.
@ -1161,16 +1170,16 @@ interface ReadonlyArray<T> {
map<U>(callbackfn: (value: T, index: number, array: readonly T[]) => U, thisArg?: any): U[];
/**
* Returns the elements of an array that meet the condition specified in a callback function.
* @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
* @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.
*/
filter<S extends T>(callbackfn: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): S[];
filter<S extends T>(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): S[];
/**
* Returns the elements of an array that meet the condition specified in a callback function.
* @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
* @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.
*/
filter(callbackfn: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): T[];
filter(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): T[];
/**
* Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
@ -1301,22 +1310,31 @@ interface Array<T> {
lastIndexOf(searchElement: T, fromIndex?: number): number;
/**
* Determines whether all the members of an array satisfy the specified test.
* @param callbackfn A function that accepts up to three arguments. The every method calls
* the callbackfn function for each element in the array until the callbackfn returns a value
* @param predicate A function that accepts up to three arguments. The every method calls
* the predicate function for each element in the array until the predicate returns a value
* which is coercible to the Boolean value false, or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
every(callbackfn: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean;
every<S extends T>(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): this is S[];
/**
* Determines whether all the members of an array satisfy the specified test.
* @param predicate A function that accepts up to three arguments. The every method calls
* the predicate function for each element in the array until the predicate returns a value
* which is coercible to the Boolean value false, or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
every(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean;
/**
* Determines whether the specified callback function returns true for any element of an array.
* @param callbackfn A function that accepts up to three arguments. The some method calls
* the callbackfn function for each element in the array until the callbackfn returns a value
* @param predicate A function that accepts up to three arguments. The some method calls
* the predicate function for each element in the array until the predicate returns a value
* which is coercible to the Boolean value true, or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
some(callbackfn: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean;
some(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean;
/**
* Performs the specified action for each element in an array.
* @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.
@ -1331,16 +1349,16 @@ interface Array<T> {
map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[];
/**
* Returns the elements of an array that meet the condition specified in a callback function.
* @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
* @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.
*/
filter<S extends T>(callbackfn: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[];
filter<S extends T>(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[];
/**
* Returns the elements of an array that meet the condition specified in a callback function.
* @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
* @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.
*/
filter(callbackfn: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[];
filter(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[];
/**
* Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
@ -1736,13 +1754,13 @@ interface Int8Array {
/**
* Determines whether all the members of an array satisfy the specified test.
* @param callbackfn A function that accepts up to three arguments. The every method calls
* the callbackfn function for each element in the array until the callbackfn returns a value
* @param predicate A function that accepts up to three arguments. The every method calls
* the predicate function for each element in the array until the predicate returns a value
* which is coercible to the Boolean value false, or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
every(callbackfn: (value: number, index: number, array: Int8Array) => unknown, thisArg?: any): boolean;
every(predicate: (value: number, index: number, array: Int8Array) => unknown, thisArg?: any): boolean;
/**
* Returns the this object after filling the section identified by start and end with value
@ -1756,12 +1774,12 @@ interface Int8Array {
/**
* Returns the elements of an array that meet the condition specified in a callback function.
* @param callbackfn A function that accepts up to three arguments. The filter method calls
* the callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param predicate A function that accepts up to three arguments. The filter method calls
* the predicate function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
filter(callbackfn: (value: number, index: number, array: Int8Array) => any, thisArg?: any): Int8Array;
filter(predicate: (value: number, index: number, array: Int8Array) => any, thisArg?: any): Int8Array;
/**
* Returns the value of the first element in the array where predicate is true, and undefined
@ -1903,13 +1921,13 @@ interface Int8Array {
/**
* Determines whether the specified callback function returns true for any element of an array.
* @param callbackfn A function that accepts up to three arguments. The some method calls
* the callbackfn function for each element in the array until the callbackfn returns a value
* @param predicate A function that accepts up to three arguments. The some method calls
* the predicate function for each element in the array until the predicate returns a value
* which is coercible to the Boolean value true, or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
some(callbackfn: (value: number, index: number, array: Int8Array) => unknown, thisArg?: any): boolean;
some(predicate: (value: number, index: number, array: Int8Array) => unknown, thisArg?: any): boolean;
/**
* Sorts an array.
@ -1948,8 +1966,8 @@ interface Int8Array {
interface Int8ArrayConstructor {
readonly prototype: Int8Array;
new(length: number): Int8Array;
new(arrayOrArrayBuffer: ArrayLike<number> | ArrayBufferLike): Int8Array;
new(buffer: ArrayBufferLike, byteOffset: number, length?: number): Int8Array;
new(array: ArrayLike<number> | ArrayBufferLike): Int8Array;
new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array;
/**
* The size in bytes of each element in the array.
@ -2018,13 +2036,13 @@ interface Uint8Array {
/**
* Determines whether all the members of an array satisfy the specified test.
* @param callbackfn A function that accepts up to three arguments. The every method calls
* the callbackfn function for each element in the array until the callbackfn returns a value
* @param predicate A function that accepts up to three arguments. The every method calls
* the predicate function for each element in the array until the predicate returns a value
* which is coercible to the Boolean value false, or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
every(callbackfn: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): boolean;
every(predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): boolean;
/**
* Returns the this object after filling the section identified by start and end with value
@ -2038,12 +2056,12 @@ interface Uint8Array {
/**
* Returns the elements of an array that meet the condition specified in a callback function.
* @param callbackfn A function that accepts up to three arguments. The filter method calls
* the callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param predicate A function that accepts up to three arguments. The filter method calls
* the predicate function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
filter(callbackfn: (value: number, index: number, array: Uint8Array) => any, thisArg?: any): Uint8Array;
filter(predicate: (value: number, index: number, array: Uint8Array) => any, thisArg?: any): Uint8Array;
/**
* Returns the value of the first element in the array where predicate is true, and undefined
@ -2185,13 +2203,13 @@ interface Uint8Array {
/**
* Determines whether the specified callback function returns true for any element of an array.
* @param callbackfn A function that accepts up to three arguments. The some method calls
* the callbackfn function for each element in the array until the callbackfn returns a value
* @param predicate A function that accepts up to three arguments. The some method calls
* the predicate function for each element in the array until the predicate returns a value
* which is coercible to the Boolean value true, or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
some(callbackfn: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): boolean;
some(predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): boolean;
/**
* Sorts an array.
@ -2231,8 +2249,8 @@ interface Uint8Array {
interface Uint8ArrayConstructor {
readonly prototype: Uint8Array;
new(length: number): Uint8Array;
new(arrayOrArrayBuffer: ArrayLike<number> | ArrayBufferLike): Uint8Array;
new(buffer: ArrayBufferLike, byteOffset: number, length?: number): Uint8Array;
new(array: ArrayLike<number> | ArrayBufferLike): Uint8Array;
new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array;
/**
* The size in bytes of each element in the array.
@ -2300,13 +2318,13 @@ interface Uint8ClampedArray {
/**
* Determines whether all the members of an array satisfy the specified test.
* @param callbackfn A function that accepts up to three arguments. The every method calls
* the callbackfn function for each element in the array until the callbackfn returns a value
* @param predicate A function that accepts up to three arguments. The every method calls
* the predicate function for each element in the array until the predicate returns a value
* which is coercible to the Boolean value false, or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => unknown, thisArg?: any): boolean;
every(predicate: (value: number, index: number, array: Uint8ClampedArray) => unknown, thisArg?: any): boolean;
/**
* Returns the this object after filling the section identified by start and end with value
@ -2320,12 +2338,12 @@ interface Uint8ClampedArray {
/**
* Returns the elements of an array that meet the condition specified in a callback function.
* @param callbackfn A function that accepts up to three arguments. The filter method calls
* the callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param predicate A function that accepts up to three arguments. The filter method calls
* the predicate function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => any, thisArg?: any): Uint8ClampedArray;
filter(predicate: (value: number, index: number, array: Uint8ClampedArray) => any, thisArg?: any): Uint8ClampedArray;
/**
* Returns the value of the first element in the array where predicate is true, and undefined
@ -2467,13 +2485,13 @@ interface Uint8ClampedArray {
/**
* Determines whether the specified callback function returns true for any element of an array.
* @param callbackfn A function that accepts up to three arguments. The some method calls
* the callbackfn function for each element in the array until the callbackfn returns a value
* @param predicate A function that accepts up to three arguments. The some method calls
* the predicate function for each element in the array until the predicate returns a value
* which is coercible to the Boolean value true, or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => unknown, thisArg?: any): boolean;
some(predicate: (value: number, index: number, array: Uint8ClampedArray) => unknown, thisArg?: any): boolean;
/**
* Sorts an array.
@ -2513,8 +2531,8 @@ interface Uint8ClampedArray {
interface Uint8ClampedArrayConstructor {
readonly prototype: Uint8ClampedArray;
new(length: number): Uint8ClampedArray;
new(arrayOrArrayBuffer: ArrayLike<number> | ArrayBufferLike): Uint8ClampedArray;
new(buffer: ArrayBufferLike, byteOffset: number, length?: number): Uint8ClampedArray;
new(array: ArrayLike<number> | ArrayBufferLike): Uint8ClampedArray;
new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray;
/**
* The size in bytes of each element in the array.
@ -2581,13 +2599,13 @@ interface Int16Array {
/**
* Determines whether all the members of an array satisfy the specified test.
* @param callbackfn A function that accepts up to three arguments. The every method calls
* the callbackfn function for each element in the array until the callbackfn returns a value
* @param predicate A function that accepts up to three arguments. The every method calls
* the predicate function for each element in the array until the predicate returns a value
* which is coercible to the Boolean value false, or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
every(callbackfn: (value: number, index: number, array: Int16Array) => unknown, thisArg?: any): boolean;
every(predicate: (value: number, index: number, array: Int16Array) => unknown, thisArg?: any): boolean;
/**
* Returns the this object after filling the section identified by start and end with value
@ -2601,12 +2619,12 @@ interface Int16Array {
/**
* Returns the elements of an array that meet the condition specified in a callback function.
* @param callbackfn A function that accepts up to three arguments. The filter method calls
* the callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param predicate A function that accepts up to three arguments. The filter method calls
* the predicate function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
filter(callbackfn: (value: number, index: number, array: Int16Array) => any, thisArg?: any): Int16Array;
filter(predicate: (value: number, index: number, array: Int16Array) => any, thisArg?: any): Int16Array;
/**
* Returns the value of the first element in the array where predicate is true, and undefined
@ -2747,13 +2765,13 @@ interface Int16Array {
/**
* Determines whether the specified callback function returns true for any element of an array.
* @param callbackfn A function that accepts up to three arguments. The some method calls
* the callbackfn function for each element in the array until the callbackfn returns a value
* @param predicate A function that accepts up to three arguments. The some method calls
* the predicate function for each element in the array until the predicate returns a value
* which is coercible to the Boolean value true, or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
some(callbackfn: (value: number, index: number, array: Int16Array) => unknown, thisArg?: any): boolean;
some(predicate: (value: number, index: number, array: Int16Array) => unknown, thisArg?: any): boolean;
/**
* Sorts an array.
@ -2793,8 +2811,8 @@ interface Int16Array {
interface Int16ArrayConstructor {
readonly prototype: Int16Array;
new(length: number): Int16Array;
new(arrayOrArrayBuffer: ArrayLike<number> | ArrayBufferLike): Int16Array;
new(buffer: ArrayBufferLike, byteOffset: number, length?: number): Int16Array;
new(array: ArrayLike<number> | ArrayBufferLike): Int16Array;
new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array;
/**
* The size in bytes of each element in the array.
@ -2863,13 +2881,13 @@ interface Uint16Array {
/**
* Determines whether all the members of an array satisfy the specified test.
* @param callbackfn A function that accepts up to three arguments. The every method calls
* the callbackfn function for each element in the array until the callbackfn returns a value
* @param predicate A function that accepts up to three arguments. The every method calls
* the predicate function for each element in the array until the predicate returns a value
* which is coercible to the Boolean value false, or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
every(callbackfn: (value: number, index: number, array: Uint16Array) => unknown, thisArg?: any): boolean;
every(predicate: (value: number, index: number, array: Uint16Array) => unknown, thisArg?: any): boolean;
/**
* Returns the this object after filling the section identified by start and end with value
@ -2883,12 +2901,12 @@ interface Uint16Array {
/**
* Returns the elements of an array that meet the condition specified in a callback function.
* @param callbackfn A function that accepts up to three arguments. The filter method calls
* the callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param predicate A function that accepts up to three arguments. The filter method calls
* the predicate function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
filter(callbackfn: (value: number, index: number, array: Uint16Array) => any, thisArg?: any): Uint16Array;
filter(predicate: (value: number, index: number, array: Uint16Array) => any, thisArg?: any): Uint16Array;
/**
* Returns the value of the first element in the array where predicate is true, and undefined
@ -3030,13 +3048,13 @@ interface Uint16Array {
/**
* Determines whether the specified callback function returns true for any element of an array.
* @param callbackfn A function that accepts up to three arguments. The some method calls
* the callbackfn function for each element in the array until the callbackfn returns a value
* @param predicate A function that accepts up to three arguments. The some method calls
* the predicate function for each element in the array until the predicate returns a value
* which is coercible to the Boolean value true, or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
some(callbackfn: (value: number, index: number, array: Uint16Array) => unknown, thisArg?: any): boolean;
some(predicate: (value: number, index: number, array: Uint16Array) => unknown, thisArg?: any): boolean;
/**
* Sorts an array.
@ -3076,8 +3094,8 @@ interface Uint16Array {
interface Uint16ArrayConstructor {
readonly prototype: Uint16Array;
new(length: number): Uint16Array;
new(arrayOrArrayBuffer: ArrayLike<number> | ArrayBufferLike): Uint16Array;
new(buffer: ArrayBufferLike, byteOffset: number, length?: number): Uint16Array;
new(array: ArrayLike<number> | ArrayBufferLike): Uint16Array;
new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array;
/**
* The size in bytes of each element in the array.
@ -3145,13 +3163,13 @@ interface Int32Array {
/**
* Determines whether all the members of an array satisfy the specified test.
* @param callbackfn A function that accepts up to three arguments. The every method calls
* the callbackfn function for each element in the array until the callbackfn returns a value
* @param predicate A function that accepts up to three arguments. The every method calls
* the predicate function for each element in the array until the predicate returns a value
* which is coercible to the Boolean value false, or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
every(callbackfn: (value: number, index: number, array: Int32Array) => unknown, thisArg?: any): boolean;
every(predicate: (value: number, index: number, array: Int32Array) => unknown, thisArg?: any): boolean;
/**
* Returns the this object after filling the section identified by start and end with value
@ -3165,12 +3183,12 @@ interface Int32Array {
/**
* Returns the elements of an array that meet the condition specified in a callback function.
* @param callbackfn A function that accepts up to three arguments. The filter method calls
* the callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param predicate A function that accepts up to three arguments. The filter method calls
* the predicate function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
filter(callbackfn: (value: number, index: number, array: Int32Array) => any, thisArg?: any): Int32Array;
filter(predicate: (value: number, index: number, array: Int32Array) => any, thisArg?: any): Int32Array;
/**
* Returns the value of the first element in the array where predicate is true, and undefined
@ -3312,13 +3330,13 @@ interface Int32Array {
/**
* Determines whether the specified callback function returns true for any element of an array.
* @param callbackfn A function that accepts up to three arguments. The some method calls
* the callbackfn function for each element in the array until the callbackfn returns a value
* @param predicate A function that accepts up to three arguments. The some method calls
* the predicate function for each element in the array until the predicate returns a value
* which is coercible to the Boolean value true, or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
some(callbackfn: (value: number, index: number, array: Int32Array) => unknown, thisArg?: any): boolean;
some(predicate: (value: number, index: number, array: Int32Array) => unknown, thisArg?: any): boolean;
/**
* Sorts an array.
@ -3358,8 +3376,8 @@ interface Int32Array {
interface Int32ArrayConstructor {
readonly prototype: Int32Array;
new(length: number): Int32Array;
new(arrayOrArrayBuffer: ArrayLike<number> | ArrayBufferLike): Int32Array;
new(buffer: ArrayBufferLike, byteOffset: number, length?: number): Int32Array;
new(array: ArrayLike<number> | ArrayBufferLike): Int32Array;
new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array;
/**
* The size in bytes of each element in the array.
@ -3427,13 +3445,13 @@ interface Uint32Array {
/**
* Determines whether all the members of an array satisfy the specified test.
* @param callbackfn A function that accepts up to three arguments. The every method calls
* the callbackfn function for each element in the array until the callbackfn returns a value
* @param predicate A function that accepts up to three arguments. The every method calls
* the predicate function for each element in the array until the predicate returns a value
* which is coercible to the Boolean value false, or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
every(callbackfn: (value: number, index: number, array: Uint32Array) => unknown, thisArg?: any): boolean;
every(predicate: (value: number, index: number, array: Uint32Array) => unknown, thisArg?: any): boolean;
/**
* Returns the this object after filling the section identified by start and end with value
@ -3447,12 +3465,12 @@ interface Uint32Array {
/**
* Returns the elements of an array that meet the condition specified in a callback function.
* @param callbackfn A function that accepts up to three arguments. The filter method calls
* the callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param predicate A function that accepts up to three arguments. The filter method calls
* the predicate function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
filter(callbackfn: (value: number, index: number, array: Uint32Array) => any, thisArg?: any): Uint32Array;
filter(predicate: (value: number, index: number, array: Uint32Array) => any, thisArg?: any): Uint32Array;
/**
* Returns the value of the first element in the array where predicate is true, and undefined
@ -3593,13 +3611,13 @@ interface Uint32Array {
/**
* Determines whether the specified callback function returns true for any element of an array.
* @param callbackfn A function that accepts up to three arguments. The some method calls
* the callbackfn function for each element in the array until the callbackfn returns a value
* @param predicate A function that accepts up to three arguments. The some method calls
* the predicate function for each element in the array until the predicate returns a value
* which is coercible to the Boolean value true, or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
some(callbackfn: (value: number, index: number, array: Uint32Array) => unknown, thisArg?: any): boolean;
some(predicate: (value: number, index: number, array: Uint32Array) => unknown, thisArg?: any): boolean;
/**
* Sorts an array.
@ -3639,8 +3657,8 @@ interface Uint32Array {
interface Uint32ArrayConstructor {
readonly prototype: Uint32Array;
new(length: number): Uint32Array;
new(arrayOrArrayBuffer: ArrayLike<number> | ArrayBufferLike): Uint32Array;
new(buffer: ArrayBufferLike, byteOffset: number, length?: number): Uint32Array;
new(array: ArrayLike<number> | ArrayBufferLike): Uint32Array;
new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array;
/**
* The size in bytes of each element in the array.
@ -3708,13 +3726,13 @@ interface Float32Array {
/**
* Determines whether all the members of an array satisfy the specified test.
* @param callbackfn A function that accepts up to three arguments. The every method calls
* the callbackfn function for each element in the array until the callbackfn returns a value
* @param predicate A function that accepts up to three arguments. The every method calls
* the predicate function for each element in the array until the predicate returns a value
* which is coercible to the Boolean value false, or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
every(callbackfn: (value: number, index: number, array: Float32Array) => unknown, thisArg?: any): boolean;
every(predicate: (value: number, index: number, array: Float32Array) => unknown, thisArg?: any): boolean;
/**
* Returns the this object after filling the section identified by start and end with value
@ -3728,12 +3746,12 @@ interface Float32Array {
/**
* Returns the elements of an array that meet the condition specified in a callback function.
* @param callbackfn A function that accepts up to three arguments. The filter method calls
* the callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param predicate A function that accepts up to three arguments. The filter method calls
* the predicate function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
filter(callbackfn: (value: number, index: number, array: Float32Array) => any, thisArg?: any): Float32Array;
filter(predicate: (value: number, index: number, array: Float32Array) => any, thisArg?: any): Float32Array;
/**
* Returns the value of the first element in the array where predicate is true, and undefined
@ -3875,13 +3893,13 @@ interface Float32Array {
/**
* Determines whether the specified callback function returns true for any element of an array.
* @param callbackfn A function that accepts up to three arguments. The some method calls
* the callbackfn function for each element in the array until the callbackfn returns a value
* @param predicate A function that accepts up to three arguments. The some method calls
* the predicate function for each element in the array until the predicate returns a value
* which is coercible to the Boolean value true, or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
some(callbackfn: (value: number, index: number, array: Float32Array) => unknown, thisArg?: any): boolean;
some(predicate: (value: number, index: number, array: Float32Array) => unknown, thisArg?: any): boolean;
/**
* Sorts an array.
@ -3921,8 +3939,8 @@ interface Float32Array {
interface Float32ArrayConstructor {
readonly prototype: Float32Array;
new(length: number): Float32Array;
new(arrayOrArrayBuffer: ArrayLike<number> | ArrayBufferLike): Float32Array;
new(buffer: ArrayBufferLike, byteOffset: number, length?: number): Float32Array;
new(array: ArrayLike<number> | ArrayBufferLike): Float32Array;
new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array;
/**
* The size in bytes of each element in the array.
@ -3991,13 +4009,13 @@ interface Float64Array {
/**
* Determines whether all the members of an array satisfy the specified test.
* @param callbackfn A function that accepts up to three arguments. The every method calls
* the callbackfn function for each element in the array until the callbackfn returns a value
* @param predicate A function that accepts up to three arguments. The every method calls
* the predicate function for each element in the array until the predicate returns a value
* which is coercible to the Boolean value false, or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
every(callbackfn: (value: number, index: number, array: Float64Array) => unknown, thisArg?: any): boolean;
every(predicate: (value: number, index: number, array: Float64Array) => unknown, thisArg?: any): boolean;
/**
* Returns the this object after filling the section identified by start and end with value
@ -4011,12 +4029,12 @@ interface Float64Array {
/**
* Returns the elements of an array that meet the condition specified in a callback function.
* @param callbackfn A function that accepts up to three arguments. The filter method calls
* the callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param predicate A function that accepts up to three arguments. The filter method calls
* the predicate function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
filter(callbackfn: (value: number, index: number, array: Float64Array) => any, thisArg?: any): Float64Array;
filter(predicate: (value: number, index: number, array: Float64Array) => any, thisArg?: any): Float64Array;
/**
* Returns the value of the first element in the array where predicate is true, and undefined
@ -4158,13 +4176,13 @@ interface Float64Array {
/**
* Determines whether the specified callback function returns true for any element of an array.
* @param callbackfn A function that accepts up to three arguments. The some method calls
* the callbackfn function for each element in the array until the callbackfn returns a value
* @param predicate A function that accepts up to three arguments. The some method calls
* the predicate function for each element in the array until the predicate returns a value
* which is coercible to the Boolean value true, or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* @param thisArg An object to which the this keyword can refer in the predicate function.
* If thisArg is omitted, undefined is used as the this value.
*/
some(callbackfn: (value: number, index: number, array: Float64Array) => unknown, thisArg?: any): boolean;
some(predicate: (value: number, index: number, array: Float64Array) => unknown, thisArg?: any): boolean;
/**
* Sorts an array.
@ -4195,8 +4213,8 @@ interface Float64Array {
interface Float64ArrayConstructor {
readonly prototype: Float64Array;
new(length: number): Float64Array;
new(arrayOrArrayBuffer: ArrayLike<number> | ArrayBufferLike): Float64Array;
new(buffer: ArrayBufferLike, byteOffset: number, length?: number): Float64Array;
new(array: ArrayLike<number> | ArrayBufferLike): Float64Array;
new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array;
/**
* The size in bytes of each element in the array.

View File

@ -1,223 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface ReadonlyArray<T> {
/**
* Calls a defined callback function on each element of an array. Then, flattens the result into
* a new array.
* This is identical to a map followed by flat with depth 1.
*
* @param callback A function that accepts up to three arguments. The flatMap method calls the
* callback function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callback function. If
* thisArg is omitted, undefined is used as the this value.
*/
flatMap<U, This = undefined> (
callback: (this: This, value: T, index: number, array: T[]) => U|ReadonlyArray<U>,
thisArg?: This
): U[]
/**
* Returns a new array with all sub-array elements concatenated into it recursively up to the
* specified depth.
*
* @param depth The maximum recursion depth
*/
flat<U>(this:
ReadonlyArray<U[][][][]> |
ReadonlyArray<ReadonlyArray<U[][][]>> |
ReadonlyArray<ReadonlyArray<U[][]>[]> |
ReadonlyArray<ReadonlyArray<U[]>[][]> |
ReadonlyArray<ReadonlyArray<U>[][][]> |
ReadonlyArray<ReadonlyArray<ReadonlyArray<U[][]>>> |
ReadonlyArray<ReadonlyArray<ReadonlyArray<U>[][]>> |
ReadonlyArray<ReadonlyArray<ReadonlyArray<U>>[][]> |
ReadonlyArray<ReadonlyArray<ReadonlyArray<U>[]>[]> |
ReadonlyArray<ReadonlyArray<ReadonlyArray<U[]>>[]> |
ReadonlyArray<ReadonlyArray<ReadonlyArray<U[]>[]>> |
ReadonlyArray<ReadonlyArray<ReadonlyArray<ReadonlyArray<U[]>>>> |
ReadonlyArray<ReadonlyArray<ReadonlyArray<ReadonlyArray<U>[]>>> |
ReadonlyArray<ReadonlyArray<ReadonlyArray<ReadonlyArray<U>>[]>> |
ReadonlyArray<ReadonlyArray<ReadonlyArray<ReadonlyArray<U>>>[]> |
ReadonlyArray<ReadonlyArray<ReadonlyArray<ReadonlyArray<ReadonlyArray<U>>>>>,
depth: 4): U[];
/**
* Returns a new array with all sub-array elements concatenated into it recursively up to the
* specified depth.
*
* @param depth The maximum recursion depth
*/
flat<U>(this:
ReadonlyArray<U[][][]> |
ReadonlyArray<ReadonlyArray<U>[][]> |
ReadonlyArray<ReadonlyArray<U[]>[]> |
ReadonlyArray<ReadonlyArray<U[][]>> |
ReadonlyArray<ReadonlyArray<ReadonlyArray<U[]>>> |
ReadonlyArray<ReadonlyArray<ReadonlyArray<U>[]>> |
ReadonlyArray<ReadonlyArray<ReadonlyArray<U>>[]> |
ReadonlyArray<ReadonlyArray<ReadonlyArray<ReadonlyArray<U>>>>,
depth: 3): U[];
/**
* Returns a new array with all sub-array elements concatenated into it recursively up to the
* specified depth.
*
* @param depth The maximum recursion depth
*/
flat<U>(this:
ReadonlyArray<U[][]> |
ReadonlyArray<ReadonlyArray<U[]>> |
ReadonlyArray<ReadonlyArray<U>[]> |
ReadonlyArray<ReadonlyArray<ReadonlyArray<U>>>,
depth: 2): U[];
/**
* Returns a new array with all sub-array elements concatenated into it recursively up to the
* specified depth.
*
* @param depth The maximum recursion depth
*/
flat<U>(this:
ReadonlyArray<U[]> |
ReadonlyArray<ReadonlyArray<U>>,
depth?: 1
): U[];
/**
* Returns a new array with all sub-array elements concatenated into it recursively up to the
* specified depth.
*
* @param depth The maximum recursion depth
*/
flat<U>(this:
ReadonlyArray<U>,
depth: 0
): U[];
/**
* Returns a new array with all sub-array elements concatenated into it recursively up to the
* specified depth. If no depth is provided, flat method defaults to the depth of 1.
*
* @param depth The maximum recursion depth
*/
flat<U>(depth?: number): any[];
}
interface Array<T> {
/**
* Calls a defined callback function on each element of an array. Then, flattens the result into
* a new array.
* This is identical to a map followed by flat with depth 1.
*
* @param callback A function that accepts up to three arguments. The flatMap method calls the
* callback function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callback function. If
* thisArg is omitted, undefined is used as the this value.
*/
flatMap<U, This = undefined> (
callback: (this: This, value: T, index: number, array: T[]) => U|ReadonlyArray<U>,
thisArg?: This
): U[]
/**
* Returns a new array with all sub-array elements concatenated into it recursively up to the
* specified depth.
*
* @param depth The maximum recursion depth
*/
flat<U>(this: U[][][][][][][][], depth: 7): U[];
/**
* Returns a new array with all sub-array elements concatenated into it recursively up to the
* specified depth.
*
* @param depth The maximum recursion depth
*/
flat<U>(this: U[][][][][][][], depth: 6): U[];
/**
* Returns a new array with all sub-array elements concatenated into it recursively up to the
* specified depth.
*
* @param depth The maximum recursion depth
*/
flat<U>(this: U[][][][][][], depth: 5): U[];
/**
* Returns a new array with all sub-array elements concatenated into it recursively up to the
* specified depth.
*
* @param depth The maximum recursion depth
*/
flat<U>(this: U[][][][][], depth: 4): U[];
/**
* Returns a new array with all sub-array elements concatenated into it recursively up to the
* specified depth.
*
* @param depth The maximum recursion depth
*/
flat<U>(this: U[][][][], depth: 3): U[];
/**
* Returns a new array with all sub-array elements concatenated into it recursively up to the
* specified depth.
*
* @param depth The maximum recursion depth
*/
flat<U>(this: U[][][], depth: 2): U[];
/**
* Returns a new array with all sub-array elements concatenated into it recursively up to the
* specified depth.
*
* @param depth The maximum recursion depth
*/
flat<U>(this: U[][], depth?: 1): U[];
/**
* Returns a new array with all sub-array elements concatenated into it recursively up to the
* specified depth.
*
* @param depth The maximum recursion depth
*/
flat<U>(this: U[], depth: 0): U[];
/**
* Returns a new array with all sub-array elements concatenated into it recursively up to the
* specified depth. If no depth is provided, flat method defaults to the depth of 1.
*
* @param depth The maximum recursion depth
*/
flat<U>(depth?: number): any[];
}

View File

@ -1,44 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2015.symbol" />
/// <reference lib="es2015.iterable" />
interface SymbolConstructor {
/**
* A method that returns the default async iterator for an object. Called by the semantics of
* the for-await-of statement.
*/
readonly asyncIterator: symbol;
}
interface AsyncIterator<T> {
next(value?: any): Promise<IteratorResult<T>>;
return?(value?: any): Promise<IteratorResult<T>>;
throw?(e?: any): Promise<IteratorResult<T>>;
}
interface AsyncIterable<T> {
[Symbol.asyncIterator](): AsyncIterator<T>;
}
interface AsyncIterableIterator<T> extends AsyncIterator<T> {
[Symbol.asyncIterator](): AsyncIterableIterator<T>;
}

View File

@ -1,629 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface BigInt {
/**
* Returns a string representation of an object.
* @param radix Specifies a radix for converting numeric values to strings.
*/
toString(radix?: number): string;
/** Returns a string representation appropriate to the host environment's current locale. */
toLocaleString(): string;
/** Returns the primitive value of the specified object. */
valueOf(): bigint;
readonly [Symbol.toStringTag]: "BigInt";
}
interface BigIntConstructor {
(value?: any): bigint;
readonly prototype: BigInt;
/**
* Interprets the low bits of a BigInt as a 2's-complement signed integer.
* All higher bits are discarded.
* @param bits The number of low bits to use
* @param int The BigInt whose bits to extract
*/
asIntN(bits: number, int: bigint): bigint;
/**
* Interprets the low bits of a BigInt as an unsigned integer.
* All higher bits are discarded.
* @param bits The number of low bits to use
* @param int The BigInt whose bits to extract
*/
asUintN(bits: number, int: bigint): bigint;
}
declare var BigInt: BigIntConstructor;
/**
* A typed array of 64-bit signed integer values. The contents are initialized to 0. If the
* requested number of bytes could not be allocated, an exception is raised.
*/
interface BigInt64Array {
/** The size in bytes of each element in the array. */
readonly BYTES_PER_ELEMENT: number;
/** The ArrayBuffer instance referenced by the array. */
readonly buffer: ArrayBufferLike;
/** The length in bytes of the array. */
readonly byteLength: number;
/** The offset in bytes of the array. */
readonly byteOffset: number;
/**
* Returns the this object after copying a section of the array identified by start and end
* to the same array starting at position target
* @param target If target is negative, it is treated as length+target where length is the
* length of the array.
* @param start If start is negative, it is treated as length+start. If end is negative, it
* is treated as length+end.
* @param end If not specified, length of the this object is used as its default value.
*/
copyWithin(target: number, start: number, end?: number): this;
/** Yields index, value pairs for every entry in the array. */
entries(): IterableIterator<[number, bigint]>;
/**
* Determines whether all the members of an array satisfy the specified test.
* @param callbackfn A function that accepts up to three arguments. The every method calls
* the callbackfn function for each element in the array until the callbackfn returns false,
* or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* If thisArg is omitted, undefined is used as the this value.
*/
every(callbackfn: (value: bigint, index: number, array: BigInt64Array) => boolean, thisArg?: any): boolean;
/**
* Returns the this object after filling the section identified by start and end with value
* @param value value to fill array section with
* @param start index to start filling the array at. If start is negative, it is treated as
* length+start where length is the length of the array.
* @param end index to stop filling the array at. If end is negative, it is treated as
* length+end.
*/
fill(value: bigint, start?: number, end?: number): this;
/**
* Returns the elements of an array that meet the condition specified in a callback function.
* @param callbackfn A function that accepts up to three arguments. The filter method calls
* the callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* If thisArg is omitted, undefined is used as the this value.
*/
filter(callbackfn: (value: bigint, index: number, array: BigInt64Array) => any, thisArg?: any): BigInt64Array;
/**
* Returns the value of the first element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found, find
* immediately returns that element value. Otherwise, find returns undefined.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
find(predicate: (value: bigint, index: number, array: BigInt64Array) => boolean, thisArg?: any): bigint | undefined;
/**
* Returns the index of the first element in the array where predicate is true, and -1
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found,
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findIndex(predicate: (value: bigint, index: number, array: BigInt64Array) => boolean, thisArg?: any): number;
/**
* Performs the specified action for each element in an array.
* @param callbackfn A function that accepts up to three arguments. forEach calls the
* callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* If thisArg is omitted, undefined is used as the this value.
*/
forEach(callbackfn: (value: bigint, index: number, array: BigInt64Array) => void, thisArg?: any): void;
/**
* Determines whether an array includes a certain element, returning true or false as appropriate.
* @param searchElement The element to search for.
* @param fromIndex The position in this array at which to begin searching for searchElement.
*/
includes(searchElement: bigint, fromIndex?: number): boolean;
/**
* Returns the index of the first occurrence of a value in an array.
* @param searchElement The value to locate in the array.
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
* search starts at index 0.
*/
indexOf(searchElement: bigint, fromIndex?: number): number;
/**
* Adds all the elements of an array separated by the specified separator string.
* @param separator A string used to separate one element of an array from the next in the
* resulting String. If omitted, the array elements are separated with a comma.
*/
join(separator?: string): string;
/** Yields each index in the array. */
keys(): IterableIterator<number>;
/**
* Returns the index of the last occurrence of a value in an array.
* @param searchElement The value to locate in the array.
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
* search starts at index 0.
*/
lastIndexOf(searchElement: bigint, fromIndex?: number): number;
/** The length of the array. */
readonly length: number;
/**
* Calls a defined callback function on each element of an array, and returns an array that
* contains the results.
* @param callbackfn A function that accepts up to three arguments. The map method calls the
* callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* If thisArg is omitted, undefined is used as the this value.
*/
map(callbackfn: (value: bigint, index: number, array: BigInt64Array) => bigint, thisArg?: any): BigInt64Array;
/**
* Calls the specified callback function for all the elements in an array. The return value of
* the callback function is the accumulated result, and is provided as an argument in the next
* call to the callback function.
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the
* callbackfn function one time for each element in the array.
* @param initialValue If initialValue is specified, it is used as the initial value to start
* the accumulation. The first call to the callbackfn function provides this value as an argument
* instead of an array value.
*/
reduce(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigInt64Array) => bigint): bigint;
/**
* Calls the specified callback function for all the elements in an array. The return value of
* the callback function is the accumulated result, and is provided as an argument in the next
* call to the callback function.
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the
* callbackfn function one time for each element in the array.
* @param initialValue If initialValue is specified, it is used as the initial value to start
* the accumulation. The first call to the callbackfn function provides this value as an argument
* instead of an array value.
*/
reduce<U>(callbackfn: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigInt64Array) => U, initialValue: U): U;
/**
* Calls the specified callback function for all the elements in an array, in descending order.
* The return value of the callback function is the accumulated result, and is provided as an
* argument in the next call to the callback function.
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
* the callbackfn function one time for each element in the array.
* @param initialValue If initialValue is specified, it is used as the initial value to start
* the accumulation. The first call to the callbackfn function provides this value as an
* argument instead of an array value.
*/
reduceRight(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigInt64Array) => bigint): bigint;
/**
* Calls the specified callback function for all the elements in an array, in descending order.
* The return value of the callback function is the accumulated result, and is provided as an
* argument in the next call to the callback function.
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
* the callbackfn function one time for each element in the array.
* @param initialValue If initialValue is specified, it is used as the initial value to start
* the accumulation. The first call to the callbackfn function provides this value as an argument
* instead of an array value.
*/
reduceRight<U>(callbackfn: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigInt64Array) => U, initialValue: U): U;
/** Reverses the elements in the array. */
reverse(): this;
/**
* Sets a value or an array of values.
* @param array A typed or untyped array of values to set.
* @param offset The index in the current array at which the values are to be written.
*/
set(array: ArrayLike<bigint>, offset?: number): void;
/**
* Returns a section of an array.
* @param start The beginning of the specified portion of the array.
* @param end The end of the specified portion of the array.
*/
slice(start?: number, end?: number): BigInt64Array;
/**
* Determines whether the specified callback function returns true for any element of an array.
* @param callbackfn A function that accepts up to three arguments. The some method calls the
* callbackfn function for each element in the array until the callbackfn returns true, or until
* the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* If thisArg is omitted, undefined is used as the this value.
*/
some(callbackfn: (value: bigint, index: number, array: BigInt64Array) => boolean, thisArg?: any): boolean;
/**
* Sorts the array.
* @param compareFn The function used to determine the order of the elements. If omitted, the elements are sorted in ascending order.
*/
sort(compareFn?: (a: bigint, b: bigint) => number | bigint): this;
/**
* Gets a new BigInt64Array view of the ArrayBuffer store for this array, referencing the elements
* at begin, inclusive, up to end, exclusive.
* @param begin The index of the beginning of the array.
* @param end The index of the end of the array.
*/
subarray(begin: number, end?: number): BigInt64Array;
/** Converts the array to a string by using the current locale. */
toLocaleString(): string;
/** Returns a string representation of the array. */
toString(): string;
/** Yields each value in the array. */
values(): IterableIterator<bigint>;
[Symbol.iterator](): IterableIterator<bigint>;
readonly [Symbol.toStringTag]: "BigInt64Array";
[index: number]: bigint;
}
interface BigInt64ArrayConstructor {
readonly prototype: BigInt64Array;
new(length?: number): BigInt64Array;
new(array: Iterable<bigint>): BigInt64Array;
new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): BigInt64Array;
/** The size in bytes of each element in the array. */
readonly BYTES_PER_ELEMENT: number;
/**
* Returns a new array from a set of elements.
* @param items A set of elements to include in the new array object.
*/
of(...items: bigint[]): BigInt64Array;
/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: ArrayLike<bigint>): BigInt64Array;
from<U>(arrayLike: ArrayLike<U>, mapfn: (v: U, k: number) => bigint, thisArg?: any): BigInt64Array;
}
declare var BigInt64Array: BigInt64ArrayConstructor;
/**
* A typed array of 64-bit unsigned integer values. The contents are initialized to 0. If the
* requested number of bytes could not be allocated, an exception is raised.
*/
interface BigUint64Array {
/** The size in bytes of each element in the array. */
readonly BYTES_PER_ELEMENT: number;
/** The ArrayBuffer instance referenced by the array. */
readonly buffer: ArrayBufferLike;
/** The length in bytes of the array. */
readonly byteLength: number;
/** The offset in bytes of the array. */
readonly byteOffset: number;
/**
* Returns the this object after copying a section of the array identified by start and end
* to the same array starting at position target
* @param target If target is negative, it is treated as length+target where length is the
* length of the array.
* @param start If start is negative, it is treated as length+start. If end is negative, it
* is treated as length+end.
* @param end If not specified, length of the this object is used as its default value.
*/
copyWithin(target: number, start: number, end?: number): this;
/** Yields index, value pairs for every entry in the array. */
entries(): IterableIterator<[number, bigint]>;
/**
* Determines whether all the members of an array satisfy the specified test.
* @param callbackfn A function that accepts up to three arguments. The every method calls
* the callbackfn function for each element in the array until the callbackfn returns false,
* or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* If thisArg is omitted, undefined is used as the this value.
*/
every(callbackfn: (value: bigint, index: number, array: BigUint64Array) => boolean, thisArg?: any): boolean;
/**
* Returns the this object after filling the section identified by start and end with value
* @param value value to fill array section with
* @param start index to start filling the array at. If start is negative, it is treated as
* length+start where length is the length of the array.
* @param end index to stop filling the array at. If end is negative, it is treated as
* length+end.
*/
fill(value: bigint, start?: number, end?: number): this;
/**
* Returns the elements of an array that meet the condition specified in a callback function.
* @param callbackfn A function that accepts up to three arguments. The filter method calls
* the callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* If thisArg is omitted, undefined is used as the this value.
*/
filter(callbackfn: (value: bigint, index: number, array: BigUint64Array) => any, thisArg?: any): BigUint64Array;
/**
* Returns the value of the first element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found, find
* immediately returns that element value. Otherwise, find returns undefined.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
find(predicate: (value: bigint, index: number, array: BigUint64Array) => boolean, thisArg?: any): bigint | undefined;
/**
* Returns the index of the first element in the array where predicate is true, and -1
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found,
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findIndex(predicate: (value: bigint, index: number, array: BigUint64Array) => boolean, thisArg?: any): number;
/**
* Performs the specified action for each element in an array.
* @param callbackfn A function that accepts up to three arguments. forEach calls the
* callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* If thisArg is omitted, undefined is used as the this value.
*/
forEach(callbackfn: (value: bigint, index: number, array: BigUint64Array) => void, thisArg?: any): void;
/**
* Determines whether an array includes a certain element, returning true or false as appropriate.
* @param searchElement The element to search for.
* @param fromIndex The position in this array at which to begin searching for searchElement.
*/
includes(searchElement: bigint, fromIndex?: number): boolean;
/**
* Returns the index of the first occurrence of a value in an array.
* @param searchElement The value to locate in the array.
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
* search starts at index 0.
*/
indexOf(searchElement: bigint, fromIndex?: number): number;
/**
* Adds all the elements of an array separated by the specified separator string.
* @param separator A string used to separate one element of an array from the next in the
* resulting String. If omitted, the array elements are separated with a comma.
*/
join(separator?: string): string;
/** Yields each index in the array. */
keys(): IterableIterator<number>;
/**
* Returns the index of the last occurrence of a value in an array.
* @param searchElement The value to locate in the array.
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
* search starts at index 0.
*/
lastIndexOf(searchElement: bigint, fromIndex?: number): number;
/** The length of the array. */
readonly length: number;
/**
* Calls a defined callback function on each element of an array, and returns an array that
* contains the results.
* @param callbackfn A function that accepts up to three arguments. The map method calls the
* callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* If thisArg is omitted, undefined is used as the this value.
*/
map(callbackfn: (value: bigint, index: number, array: BigUint64Array) => bigint, thisArg?: any): BigUint64Array;
/**
* Calls the specified callback function for all the elements in an array. The return value of
* the callback function is the accumulated result, and is provided as an argument in the next
* call to the callback function.
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the
* callbackfn function one time for each element in the array.
* @param initialValue If initialValue is specified, it is used as the initial value to start
* the accumulation. The first call to the callbackfn function provides this value as an argument
* instead of an array value.
*/
reduce(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigUint64Array) => bigint): bigint;
/**
* Calls the specified callback function for all the elements in an array. The return value of
* the callback function is the accumulated result, and is provided as an argument in the next
* call to the callback function.
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the
* callbackfn function one time for each element in the array.
* @param initialValue If initialValue is specified, it is used as the initial value to start
* the accumulation. The first call to the callbackfn function provides this value as an argument
* instead of an array value.
*/
reduce<U>(callbackfn: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigUint64Array) => U, initialValue: U): U;
/**
* Calls the specified callback function for all the elements in an array, in descending order.
* The return value of the callback function is the accumulated result, and is provided as an
* argument in the next call to the callback function.
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
* the callbackfn function one time for each element in the array.
* @param initialValue If initialValue is specified, it is used as the initial value to start
* the accumulation. The first call to the callbackfn function provides this value as an
* argument instead of an array value.
*/
reduceRight(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigUint64Array) => bigint): bigint;
/**
* Calls the specified callback function for all the elements in an array, in descending order.
* The return value of the callback function is the accumulated result, and is provided as an
* argument in the next call to the callback function.
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
* the callbackfn function one time for each element in the array.
* @param initialValue If initialValue is specified, it is used as the initial value to start
* the accumulation. The first call to the callbackfn function provides this value as an argument
* instead of an array value.
*/
reduceRight<U>(callbackfn: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigUint64Array) => U, initialValue: U): U;
/** Reverses the elements in the array. */
reverse(): this;
/**
* Sets a value or an array of values.
* @param array A typed or untyped array of values to set.
* @param offset The index in the current array at which the values are to be written.
*/
set(array: ArrayLike<bigint>, offset?: number): void;
/**
* Returns a section of an array.
* @param start The beginning of the specified portion of the array.
* @param end The end of the specified portion of the array.
*/
slice(start?: number, end?: number): BigUint64Array;
/**
* Determines whether the specified callback function returns true for any element of an array.
* @param callbackfn A function that accepts up to three arguments. The some method calls the
* callbackfn function for each element in the array until the callbackfn returns true, or until
* the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
* If thisArg is omitted, undefined is used as the this value.
*/
some(callbackfn: (value: bigint, index: number, array: BigUint64Array) => boolean, thisArg?: any): boolean;
/**
* Sorts the array.
* @param compareFn The function used to determine the order of the elements. If omitted, the elements are sorted in ascending order.
*/
sort(compareFn?: (a: bigint, b: bigint) => number | bigint): this;
/**
* Gets a new BigUint64Array view of the ArrayBuffer store for this array, referencing the elements
* at begin, inclusive, up to end, exclusive.
* @param begin The index of the beginning of the array.
* @param end The index of the end of the array.
*/
subarray(begin: number, end?: number): BigUint64Array;
/** Converts the array to a string by using the current locale. */
toLocaleString(): string;
/** Returns a string representation of the array. */
toString(): string;
/** Yields each value in the array. */
values(): IterableIterator<bigint>;
[Symbol.iterator](): IterableIterator<bigint>;
readonly [Symbol.toStringTag]: "BigUint64Array";
[index: number]: bigint;
}
interface BigUint64ArrayConstructor {
readonly prototype: BigUint64Array;
new(length?: number): BigUint64Array;
new(array: Iterable<bigint>): BigUint64Array;
new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): BigUint64Array;
/** The size in bytes of each element in the array. */
readonly BYTES_PER_ELEMENT: number;
/**
* Returns a new array from a set of elements.
* @param items A set of elements to include in the new array object.
*/
of(...items: bigint[]): BigUint64Array;
/**
* Creates an array from an array-like or iterable object.
* @param arrayLike An array-like or iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from(arrayLike: ArrayLike<bigint>): BigUint64Array;
from<U>(arrayLike: ArrayLike<U>, mapfn: (v: U, k: number) => bigint, thisArg?: any): BigUint64Array;
}
declare var BigUint64Array: BigUint64ArrayConstructor;
interface DataView {
/**
* Gets the BigInt64 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getBigInt64(byteOffset: number, littleEndian?: boolean): bigint;
/**
* Gets the BigUint64 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getBigUint64(byteOffset: number, littleEndian?: boolean): bigint;
/**
* Stores a BigInt64 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
*/
setBigInt64(byteOffset: number, value: bigint, littleEndian?: boolean): void;
/**
* Stores a BigUint64 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
*/
setBigUint64(byteOffset: number, value: bigint, littleEndian?: boolean): void;
}

View File

@ -1,26 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface Symbol {
/**
* expose the [[Description]] internal slot of a symbol directly
*/
readonly description: string;
}

View File

@ -282,8 +282,8 @@ interface KeyAlgorithm {
name: string;
}
interface MessageEventInit extends EventInit {
data?: any;
interface MessageEventInit<T = any> extends EventInit {
data?: T;
lastEventId?: string;
origin?: string;
ports?: MessagePort[];
@ -913,7 +913,7 @@ declare var Client: {
/** Provides access to Client objects. Access it via self.clients within a service worker. */
interface Clients {
claim(): Promise<void>;
get(id: string): Promise<any>;
get(id: string): Promise<Client | undefined>;
matchAll(options?: ClientQueryOptions): Promise<ReadonlyArray<Client>>;
openWindow(url: string): Promise<WindowClient | null>;
}
@ -2241,11 +2241,11 @@ declare var MessageChannel: {
};
/** A message received by a target object. */
interface MessageEvent extends Event {
interface MessageEvent<T = any> extends Event {
/**
* Returns the data of the message.
*/
readonly data: any;
readonly data: T;
/**
* Returns the last event ID string, for server-sent events.
*/
@ -2266,7 +2266,7 @@ interface MessageEvent extends Event {
declare var MessageEvent: {
prototype: MessageEvent;
new(type: string, eventInitDict?: MessageEventInit): MessageEvent;
new<T>(type: string, eventInitDict?: MessageEventInit<T>): MessageEvent<T>;
};
interface MessagePortEventMap {
@ -3053,24 +3053,24 @@ declare var 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). */
interface SubtleCrypto {
decrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer): PromiseLike<ArrayBuffer>;
deriveBits(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, length: number): PromiseLike<ArrayBuffer>;
deriveKey(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: string | AesDerivedKeyParams | HmacImportParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, extractable: boolean, keyUsages: KeyUsage[]): PromiseLike<CryptoKey>;
digest(algorithm: AlgorithmIdentifier, data: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer): PromiseLike<ArrayBuffer>;
encrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer): PromiseLike<ArrayBuffer>;
exportKey(format: "jwk", key: CryptoKey): PromiseLike<JsonWebKey>;
exportKey(format: "raw" | "pkcs8" | "spki", key: CryptoKey): PromiseLike<ArrayBuffer>;
exportKey(format: string, key: CryptoKey): PromiseLike<JsonWebKey | ArrayBuffer>;
generateKey(algorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: KeyUsage[]): PromiseLike<CryptoKeyPair | CryptoKey>;
generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams | DhKeyGenParams, extractable: boolean, keyUsages: KeyUsage[]): PromiseLike<CryptoKeyPair>;
generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: KeyUsage[]): PromiseLike<CryptoKey>;
importKey(format: "jwk", keyData: JsonWebKey, algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): PromiseLike<CryptoKey>;
importKey(format: "raw" | "pkcs8" | "spki", keyData: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer, algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): PromiseLike<CryptoKey>;
importKey(format: string, keyData: JsonWebKey | Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer, algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): PromiseLike<CryptoKey>;
sign(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, data: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer): PromiseLike<ArrayBuffer>;
unwrapKey(format: "raw" | "pkcs8" | "spki" | "jwk" | string, wrappedKey: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, unwrappedKeyAlgorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): PromiseLike<CryptoKey>;
verify(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, signature: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer, data: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer): PromiseLike<boolean>;
wrapKey(format: "raw" | "pkcs8" | "spki" | "jwk" | string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams): PromiseLike<ArrayBuffer>;
decrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer): Promise<ArrayBuffer>;
deriveBits(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, length: number): Promise<ArrayBuffer>;
deriveKey(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: string | AesDerivedKeyParams | HmacImportParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
digest(algorithm: AlgorithmIdentifier, data: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer): Promise<ArrayBuffer>;
encrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer): Promise<ArrayBuffer>;
exportKey(format: "jwk", key: CryptoKey): Promise<JsonWebKey>;
exportKey(format: "raw" | "pkcs8" | "spki", key: CryptoKey): Promise<ArrayBuffer>;
exportKey(format: string, key: CryptoKey): Promise<JsonWebKey | ArrayBuffer>;
generateKey(algorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKeyPair | CryptoKey>;
generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams | DhKeyGenParams, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKeyPair>;
generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
importKey(format: "jwk", keyData: JsonWebKey, algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
importKey(format: "raw" | "pkcs8" | "spki", keyData: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer, algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
importKey(format: string, keyData: JsonWebKey | Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer, algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
sign(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, data: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer): Promise<ArrayBuffer>;
unwrapKey(format: "raw" | "pkcs8" | "spki" | "jwk" | string, wrappedKey: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, unwrappedKeyAlgorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams | AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
verify(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, signature: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer, data: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer): Promise<boolean>;
wrapKey(format: "raw" | "pkcs8" | "spki" | "jwk" | string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams): Promise<ArrayBuffer>;
}
declare var SubtleCrypto: {

4166
cli/dts/typescript.d.ts vendored

File diff suppressed because it is too large Load Diff

View File

@ -62,18 +62,15 @@ fn get_asset(name: &str) -> Option<&'static str> {
"lib.es2019.string.d.ts" => inc!("lib.es2019.string.d.ts"),
"lib.es2019.symbol.d.ts" => inc!("lib.es2019.symbol.d.ts"),
"lib.es2020.bigint.d.ts" => inc!("lib.es2020.bigint.d.ts"),
"lib.es2020.intl.d.ts" => inc!("lib.es2020.intl.d.ts"),
"lib.es2020.promise.d.ts" => inc!("lib.es2020.promise.d.ts"),
"lib.es2020.string.d.ts" => inc!("lib.es2020.string.d.ts"),
"lib.es2020.symbol.wellknown.d.ts" => {
inc!("lib.es2020.symbol.wellknown.d.ts")
}
"lib.esnext.array.d.ts" => inc!("lib.esnext.array.d.ts"),
"lib.esnext.asynciterable.d.ts" => inc!("lib.esnext.asynciterable.d.ts"),
"lib.esnext.bigint.d.ts" => inc!("lib.esnext.bigint.d.ts"),
"lib.esnext.intl.d.ts" => inc!("lib.esnext.intl.d.ts"),
"lib.esnext.promise.d.ts" => inc!("lib.esnext.promise.d.ts"),
"lib.esnext.string.d.ts" => inc!("lib.esnext.string.d.ts"),
"lib.esnext.symbol.d.ts" => inc!("lib.esnext.symbol.d.ts"),
"lib.scripthost.d.ts" => inc!("lib.scripthost.d.ts"),
"lib.webworker.d.ts" => inc!("lib.webworker.d.ts"),
"lib.webworker.importscripts.d.ts" => {

View File

@ -1,6 +1,7 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
const name = Deno.args[0];
const test: { [key: string]: Function } = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const test: { [key: string]: (...args: any[]) => void | Promise<void> } = {
read(files: string[]): void {
files.forEach((file) => Deno.readFileSync(file));
},

View File

@ -6,7 +6,7 @@ TypeError: relative import path "does not exist either" not prefixed with / or .
Caught error thrown by dynamically imported module.
Error: An error
at file:///[WILDCARD]tests/subdir/throws.js:5:7
at file:///[WILDCARD]tests/subdir/throws.js:6:7
Caught error thrown indirectly by dynamically imported module.
Error: An error
at file:///[WILDCARD]tests/subdir/throws.js:5:7
at file:///[WILDCARD]tests/subdir/throws.js:6:7

View File

@ -1,3 +1,4 @@
/* eslint-disable */
export function retb() {
return "b";
}

View File

@ -1,4 +1,4 @@
/* eslint-disable @typescript-eslint/camelcase, @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-explicit-any */
const { args } = Deno;
import { createHash, SupportedAlgorithm } from "../../std/hash/mod.ts";

View File

@ -1,5 +1,5 @@
[WILDCARD]
Files: 44
Files: 45
Nodes: [WILDCARD]
Identifiers: [WILDCARD]
Symbols: [WILDCARD]

View File

@ -1,6 +1,7 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
const name = Deno.args[0];
const test: { [key: string]: Function } = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const test: { [key: string]: (...args: any[]) => void | Promise<void> } = {
readRequired(): Promise<void> {
Deno.readFileSync("README.md");
return Promise.resolve();

View File

@ -1,3 +1,4 @@
/* eslint-disable */
export function boo() {
console.log("Boo!");
}

View File

@ -46,11 +46,12 @@ unitTest(function blobShouldNotThrowError(): void {
let hasThrown = false;
try {
const options1: object = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const options1: any = {
ending: "utf8",
hasOwnProperty: "hasOwnProperty",
};
const options2: object = Object.create(null);
const options2 = Object.create(null);
new Blob(["Hello World"], options1);
new Blob(["Hello World"], options2);
} catch {
@ -61,9 +62,9 @@ unitTest(function blobShouldNotThrowError(): void {
});
unitTest(function nativeEndLine(): void {
const options: object = {
const options = {
ending: "native",
};
} as const;
const blob = new Blob(["Hello\nWorld"], options);
assertEquals(blob.size, Deno.build.os === "windows" ? 12 : 11);

View File

@ -7,6 +7,7 @@ const { setPrepareStackTrace } = Deno[Deno.internal];
interface CallSite {
getThis(): unknown;
getTypeName(): string | null;
// eslint-disable-next-line @typescript-eslint/ban-types
getFunction(): Function | null;
getFunctionName(): string | null;
getMethodName(): string | null;
@ -35,6 +36,7 @@ function getMockCallSite(
getTypeName(): string {
return "";
},
// eslint-disable-next-line @typescript-eslint/ban-types
getFunction(): Function {
return (): void => {};
},

View File

@ -72,7 +72,8 @@ unitTest(function DenoNamespaceImmutable(): void {
}
assert(denoCopy === Deno);
try {
delete window.Deno;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
delete (window as any).Deno;
} catch {
// pass
}
@ -87,7 +88,8 @@ unitTest(function DenoNamespaceImmutable(): void {
}
assert(readFile === Deno.readFile);
try {
delete window.Deno.readFile;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
delete (window as any).Deno.readFile;
} catch {
// pass
}

View File

@ -7,16 +7,19 @@ import {
assertNotEquals,
} from "./test_util.ts";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type AnyRecord = Record<any, any>;
function deferred(): {
promise: Promise<{}>;
resolve: (value?: {} | PromiseLike<{}>) => void;
promise: Promise<AnyRecord>;
resolve: (value?: AnyRecord | PromiseLike<AnyRecord>) => void;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
reject: (reason?: any) => void;
} {
let resolve: (value?: {} | PromiseLike<{}>) => void;
let resolve: (value?: AnyRecord | PromiseLike<AnyRecord>) => void;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let reject: ((reason?: any) => void) | undefined = undefined;
const promise = new Promise<{}>((res, rej): void => {
const promise = new Promise<AnyRecord>((res, rej): void => {
resolve = res;
reject = rej;
});

48894
cli/tsc/00_typescript.js vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,16 +1,31 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { assert } from "../_util/assert.ts";
export function deepAssign<T, U>(target: T, source: U): T & U;
export function deepAssign<T, U, V>(
target: T,
source1: U,
source2: V,
): T & U & V;
export function deepAssign<T, U, V, W>(
target: T,
source1: U,
source2: V,
source3: W,
): T & U & V & W;
export function deepAssign(
target: Record<string, unknown>,
...sources: object[]
): object | undefined {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
target: Record<string, any>,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
...sources: any[]
): // eslint-disable-next-line @typescript-eslint/ban-types
object | undefined {
for (let i = 0; i < sources.length; i++) {
const source = sources[i];
if (!source || typeof source !== `object`) {
return;
}
Object.entries(source).forEach(([key, value]: [string, unknown]): void => {
Object.entries(source).forEach(([key, value]): void => {
if (value instanceof Date) {
target[key] = new Date(value);
return;

View File

@ -499,7 +499,9 @@ function writeScalar(
return `'${string.replace(/'/g, "''")}'`;
case STYLE_LITERAL:
return `|${blockHeader(string, state.indent)}${
dropEndingNewline(indentString(string, indent))
dropEndingNewline(
indentString(string, indent),
)
}`;
case STYLE_FOLDED:
return `>${blockHeader(string, state.indent)}${
@ -867,7 +869,10 @@ function inspectNode(
}
}
function getDuplicateReferences(object: object, state: DumperState): void {
function getDuplicateReferences(
object: Record<string, unknown>,
state: DumperState,
): void {
const objects: Any[] = [],
duplicatesIndexes: number[] = [];

View File

@ -7,7 +7,8 @@ import { parse } from "../../yaml.ts";
const yml = Deno.readFileSync(`${Deno.cwd()}/example/sample_document.yml`);
const document = new TextDecoder().decode(yml);
const obj = parse(document) as object;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const obj = parse(document) as Record<string, any>;
console.log(obj);
let i = 0;

View File

@ -813,7 +813,7 @@ function readFlowCollection(state: LoaderState, nodeIndent: number): boolean {
valueNode,
);
} else if (isPair) {
(result as Array<{}>).push(
(result as ArrayObject[]).push(
storeMappingPair(
state,
null,

View File

@ -22,7 +22,8 @@ export interface LoaderStateOptions {
onWarning?(this: null, e?: YAMLError): void;
}
export type ResultType = [] | {} | string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type ResultType = any[] | Record<string, any> | string;
export class LoaderState extends State {
public documents: Any[] = [];

View File

@ -13,6 +13,9 @@ export type DumpOptions = DumperStateOptions;
*
* You can disable exceptions by setting the skipInvalid option to true.
*/
export function stringify(obj: object, options?: DumpOptions): string {
export function stringify(
obj: Record<string, unknown>,
options?: DumpOptions,
): string {
return dump(obj, options);
}

View File

@ -17,7 +17,7 @@ interface TypeOptions {
resolve?: (data: Any) => boolean;
construct?: (data: string) => Any;
instanceOf?: Any;
predicate?: (data: object) => boolean;
predicate?: (data: Record<string, unknown>) => boolean;
represent?: RepresentFn | ArrayObject<RepresentFn>;
defaultStyle?: StyleVariant;
styleAliases?: ArrayObject;
@ -31,7 +31,7 @@ export class Type {
public tag: string;
public kind: KindType | null = null;
public instanceOf: Any;
public predicate?: (data: object) => boolean;
public predicate?: (data: Record<string, unknown>) => boolean;
public represent?: RepresentFn | ArrayObject<RepresentFn>;
public defaultStyle?: StyleVariant;
public styleAliases?: ArrayObject;

View File

@ -38,7 +38,7 @@ export function isUndefined(value: unknown): value is undefined {
return value === undefined;
}
export function isObject(value: unknown): value is object {
export function isObject(value: unknown): value is Record<string, unknown> {
return value !== null && typeof value === "object";
}

View File

@ -124,10 +124,14 @@ class Parser {
}
this.tomlLines = merged;
}
_unflat(keys: string[], values: object = {}, cObj: object = {}): object {
_unflat(
keys: string[],
values: Record<string, unknown> | unknown[] = {},
cObj: Record<string, unknown> | unknown[] = {},
): Record<string, unknown> {
const out: Record<string, unknown> = {};
if (keys.length === 0) {
return cObj;
return cObj as Record<string, unknown>;
} else {
if (Object.keys(cObj).length === 0) {
cObj = values;
@ -398,7 +402,7 @@ class Parser {
const shift = pathDeclaration.shift();
if (shift) {
k = shift.replace(/"/g, "");
v = this._unflat(pathDeclaration, v as object);
v = this._unflat(pathDeclaration, v as Record<string, unknown>);
}
} else {
k = k.replace(/"/g, "");
@ -411,7 +415,7 @@ class Parser {
}
}
}
parse(): object {
parse(): Record<string, unknown> {
this._sanitize();
this._parseLines();
this._cleanOutput();
@ -433,9 +437,9 @@ function joinKeys(keys: string[]): string {
class Dumper {
maxPad = 0;
srcObject: object;
srcObject: Record<string, unknown>;
output: string[] = [];
constructor(srcObjc: object) {
constructor(srcObjc: Record<string, unknown>) {
this.srcObject = srcObjc;
}
dump(): string[] {
@ -592,11 +596,11 @@ class Dumper {
}
}
export function stringify(srcObj: object): string {
export function stringify(srcObj: Record<string, unknown>): string {
return new Dumper(srcObj).dump().join("\n");
}
export function parse(tomlString: string): object {
export function parse(tomlString: string): Record<string, unknown> {
// File is potentially using EOL CRLF
tomlString = tomlString.replace(/\r\n/g, "\n").replace(/\\\n/g, "\n");
return new Parser(tomlString).parse();

View File

@ -6,7 +6,7 @@ import { parse, stringify } from "./toml.ts";
const testFilesDir = path.resolve("encoding", "testdata");
function parseFile(filePath: string): object {
function parseFile(filePath: string): Record<string, unknown> {
if (!existsSync(filePath)) {
throw new Error(`File not found: ${filePath}`);
}
@ -254,7 +254,6 @@ Deno.test({
Deno.test({
name: "[TOML] Cargo",
fn(): void {
/* eslint-disable @typescript-eslint/camelcase */
const expected = {
workspace: { members: ["./", "core"] },
bin: [{ name: "deno", path: "cli/main.rs" }],
@ -291,7 +290,6 @@ Deno.test({
},
target: { "cfg(windows)": { dependencies: { winapi: "0.3.6" } } },
};
/* eslint-enable @typescript-eslint/camelcase */
const actual = parseFile(path.join(testFilesDir, "cargo.toml"));
assertEquals(actual, expected);
},

File diff suppressed because one or more lines are too long

View File

@ -659,7 +659,7 @@ class Printf {
}
}
fmtV(val: object): string {
fmtV(val: Record<string, unknown>): string {
if (this.flags.sharp) {
const options = this.flags.precision !== -1
? { depth: this.flags.precision }

View File

@ -3,8 +3,6 @@
import { Sponge } from "./sponge.ts";
import { keccakf } from "./keccakf.ts";
/* eslint-disable @typescript-eslint/camelcase, @typescript-eslint/class-name-casing */
/** Sha3-224 hash */
export class Sha3_224 extends Sponge {
constructor() {

View File

@ -1,6 +1,5 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
/* eslint-disable-next-line @typescript-eslint/camelcase */
export { Sha3_224, Sha3_256, Sha3_384, Sha3_512 } from "./_sha3/sha3.ts";
export { Keccak224, Keccak256, Keccak384, Keccak512 } from "./_sha3/keccak.ts";
export { Shake128, Shake256 } from "./_sha3/shake.ts";

View File

@ -1,5 +1,5 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
/* eslint-disable @typescript-eslint/camelcase */
import { assertEquals, assertThrows } from "../testing/asserts.ts";
import {
Keccak224,

View File

@ -1,12 +1,11 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import {
LogLevels,
getLevelByName,
getLevelName,
} from "./levels.ts";
import { LogLevels, getLevelByName, getLevelName } from "./levels.ts";
import type { LevelName } from "./levels.ts";
import type { BaseHandler } from "./handlers.ts";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type GenericFunction = (...args: any[]) => any;
export interface LogRecordOptions {
msg: string;
args: unknown[];
@ -91,7 +90,7 @@ export class Logger {
*/
private _log<T>(
level: number,
msg: (T extends Function ? never : T) | (() => T),
msg: (T extends GenericFunction ? never : T) | (() => T),
...args: unknown[]
): T | undefined {
if (this.level > level) {
@ -139,45 +138,48 @@ export class Logger {
}
debug<T>(msg: () => T, ...args: unknown[]): T | undefined;
debug<T>(msg: T extends Function ? never : T, ...args: unknown[]): T;
debug<T>(msg: T extends GenericFunction ? never : T, ...args: unknown[]): T;
debug<T>(
msg: (T extends Function ? never : T) | (() => T),
msg: (T extends GenericFunction ? never : T) | (() => T),
...args: unknown[]
): T | undefined {
return this._log(LogLevels.DEBUG, msg, ...args);
}
info<T>(msg: () => T, ...args: unknown[]): T | undefined;
info<T>(msg: T extends Function ? never : T, ...args: unknown[]): T;
info<T>(msg: T extends GenericFunction ? never : T, ...args: unknown[]): T;
info<T>(
msg: (T extends Function ? never : T) | (() => T),
msg: (T extends GenericFunction ? never : T) | (() => T),
...args: unknown[]
): T | undefined {
return this._log(LogLevels.INFO, msg, ...args);
}
warning<T>(msg: () => T, ...args: unknown[]): T | undefined;
warning<T>(msg: T extends Function ? never : T, ...args: unknown[]): T;
warning<T>(msg: T extends GenericFunction ? never : T, ...args: unknown[]): T;
warning<T>(
msg: (T extends Function ? never : T) | (() => T),
msg: (T extends GenericFunction ? never : T) | (() => T),
...args: unknown[]
): T | undefined {
return this._log(LogLevels.WARNING, msg, ...args);
}
error<T>(msg: () => T, ...args: unknown[]): T | undefined;
error<T>(msg: T extends Function ? never : T, ...args: unknown[]): T;
error<T>(msg: T extends GenericFunction ? never : T, ...args: unknown[]): T;
error<T>(
msg: (T extends Function ? never : T) | (() => T),
msg: (T extends GenericFunction ? never : T) | (() => T),
...args: unknown[]
): T | undefined {
return this._log(LogLevels.ERROR, msg, ...args);
}
critical<T>(msg: () => T, ...args: unknown[]): T | undefined;
critical<T>(msg: T extends Function ? never : T, ...args: unknown[]): T;
critical<T>(
msg: (T extends Function ? never : T) | (() => T),
msg: T extends GenericFunction ? never : T,
...args: unknown[]
): T;
critical<T>(
msg: (T extends GenericFunction ? never : T) | (() => T),
...args: unknown[]
): T | undefined {
return this._log(LogLevels.CRITICAL, msg, ...args);

View File

@ -1,5 +1,6 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { Logger } from "./logger.ts";
import type { GenericFunction } from "./logger.ts";
import {
BaseHandler,
ConsoleHandler,
@ -76,11 +77,11 @@ export function getLogger(name?: string): Logger {
export function debug<T>(msg: () => T, ...args: unknown[]): T | undefined;
export function debug<T>(
msg: T extends Function ? never : T,
msg: T extends GenericFunction ? never : T,
...args: unknown[]
): T;
export function debug<T>(
msg: (T extends Function ? never : T) | (() => T),
msg: (T extends GenericFunction ? never : T) | (() => T),
...args: unknown[]
): T | undefined {
// Assist TS compiler with pass-through generic type
@ -92,11 +93,11 @@ export function debug<T>(
export function info<T>(msg: () => T, ...args: unknown[]): T | undefined;
export function info<T>(
msg: T extends Function ? never : T,
msg: T extends GenericFunction ? never : T,
...args: unknown[]
): T;
export function info<T>(
msg: (T extends Function ? never : T) | (() => T),
msg: (T extends GenericFunction ? never : T) | (() => T),
...args: unknown[]
): T | undefined {
// Assist TS compiler with pass-through generic type
@ -108,11 +109,11 @@ export function info<T>(
export function warning<T>(msg: () => T, ...args: unknown[]): T | undefined;
export function warning<T>(
msg: T extends Function ? never : T,
msg: T extends GenericFunction ? never : T,
...args: unknown[]
): T;
export function warning<T>(
msg: (T extends Function ? never : T) | (() => T),
msg: (T extends GenericFunction ? never : T) | (() => T),
...args: unknown[]
): T | undefined {
// Assist TS compiler with pass-through generic type
@ -124,11 +125,11 @@ export function warning<T>(
export function error<T>(msg: () => T, ...args: unknown[]): T | undefined;
export function error<T>(
msg: T extends Function ? never : T,
msg: T extends GenericFunction ? never : T,
...args: unknown[]
): T;
export function error<T>(
msg: (T extends Function ? never : T) | (() => T),
msg: (T extends GenericFunction ? never : T) | (() => T),
...args: unknown[]
): T | undefined {
// Assist TS compiler with pass-through generic type
@ -140,11 +141,11 @@ export function error<T>(
export function critical<T>(msg: () => T, ...args: unknown[]): T | undefined;
export function critical<T>(
msg: T extends Function ? never : T,
msg: T extends GenericFunction ? never : T,
...args: unknown[]
): T;
export function critical<T>(
msg: (T extends Function ? never : T) | (() => T),
msg: (T extends GenericFunction ? never : T) | (() => T),
...args: unknown[]
): T | undefined {
// Assist TS compiler with pass-through generic type

View File

@ -8,9 +8,9 @@ import { notImplemented } from "../_utils.ts";
//TODO - 'path' can also be a Buffer. Neither of these polyfills
//is available yet. See https://github.com/denoland/deno/issues/3403
export function access(
path: string | URL, // eslint-disable-line @typescript-eslint/no-unused-vars
modeOrCallback: number | Function, // eslint-disable-line @typescript-eslint/no-unused-vars
callback?: CallbackWithError, // eslint-disable-line @typescript-eslint/no-unused-vars
_path: string | URL,
_modeOrCallback: number | ((...args: unknown[]) => void),
_callback?: CallbackWithError,
): void {
notImplemented("Not yet available");
}

View File

@ -47,7 +47,13 @@ export function isFileOptions(
}
export function getEncoding(
optOrCallback?: FileOptions | WriteFileOptions | Function | Encodings | null,
optOrCallback?:
| FileOptions
| WriteFileOptions
// eslint-disable-next-line @typescript-eslint/no-explicit-any
| ((...args: any[]) => any)
| Encodings
| null,
): Encodings | null {
if (!optOrCallback || typeof optOrCallback === "function") {
return null;

View File

@ -17,7 +17,8 @@ export default class Dir {
return this.dirPath;
}
read(callback?: Function): Promise<Dirent | null> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
read(callback?: (...args: any[]) => void): Promise<Dirent | null> {
return new Promise((resolve, reject) => {
if (!this.asyncIterator) {
this.asyncIterator = Deno.readDir(this.path)[Symbol.asyncIterator]();
@ -55,7 +56,8 @@ export default class Dir {
* directories, and therefore does not need to close directories when
* finished reading.
*/
close(callback?: Function): Promise<void> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
close(callback?: (...args: any[]) => void): Promise<void> {
return new Promise((resolve, reject) => {
try {
if (callback) {

View File

@ -56,7 +56,11 @@ class NodeInvalidArgTypeError extends TypeError {
}
}
export function promisify(original: Function): Function {
export function promisify(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
original: (...args: any[]) => void,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
): (...args: any[]) => Promise<any> {
if (typeof original !== "function") {
throw new NodeInvalidArgTypeError("original", "Function", original);
}

View File

@ -29,6 +29,9 @@ import {
import { promisify } from "./_util_promisify.ts";
import * as fs from "../fs.ts";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type VoidFunction = (...args: any[]) => void;
const readFile = promisify(fs.readFile);
const customPromisifyArgs = Symbol.for("nodejs.util.promisify.customArgs");
@ -87,7 +90,7 @@ Deno.test("Custom promisify args", async function testPromisifyCustomArgs() {
const firstValue = 5;
const secondValue = 17;
function fn(callback: Function): void {
function fn(callback: VoidFunction): void {
callback(null, firstValue, secondValue);
}
@ -101,7 +104,7 @@ Deno.test("Custom promisify args", async function testPromisifyCustomArgs() {
Deno.test(
"Multiple callback args without custom promisify args",
async function testPromisifyWithoutCustomArgs() {
function fn(callback: Function): void {
function fn(callback: VoidFunction): void {
callback(null, "foo", "bar");
}
const value = await promisify(fn)();
@ -112,7 +115,7 @@ Deno.test(
Deno.test(
"Undefined resolved value",
async function testPromisifyWithUndefinedResolvedValue() {
function fn(callback: Function): void {
function fn(callback: VoidFunction): void {
callback(null);
}
const value = await promisify(fn)();
@ -123,7 +126,7 @@ Deno.test(
Deno.test(
"Undefined resolved value II",
async function testPromisifyWithUndefinedResolvedValueII() {
function fn(callback: Function): void {
function fn(callback: VoidFunction): void {
callback();
}
const value = await promisify(fn)();
@ -134,7 +137,7 @@ Deno.test(
Deno.test(
"Resolved value: number",
async function testPromisifyWithNumberResolvedValue() {
function fn(err: Error | null, val: number, callback: Function): void {
function fn(err: Error | null, val: number, callback: VoidFunction): void {
callback(err, val);
}
const value = await promisify(fn)(null, 42);
@ -145,7 +148,7 @@ Deno.test(
Deno.test(
"Rejected value",
async function testPromisifyWithNumberRejectedValue() {
function fn(err: Error | null, val: null, callback: Function): void {
function fn(err: Error | null, val: null, callback: VoidFunction): void {
callback(err, val);
}
await assertThrowsAsync(
@ -157,9 +160,8 @@ Deno.test(
);
Deno.test("Rejected value", async function testPromisifyWithAsObjectMethod() {
const o: { fn?: Function } = {};
const fn = promisify(function (cb: Function): void {
// @ts-expect-error TypeScript
const o: { fn?: VoidFunction } = {};
const fn = promisify(function (this: unknown, cb: VoidFunction): void {
cb(null, this === o);
});
@ -177,7 +179,7 @@ Deno.test(
);
const stack = err.stack;
const fn = promisify(function (cb: Function): void {
const fn = promisify(function (cb: VoidFunction): void {
cb(null);
cb(err);
});
@ -203,7 +205,7 @@ Deno.test("Test error", async function testInvalidArguments() {
a: number,
b: number,
c: number,
cb: Function,
cb: VoidFunction,
): void {
errToThrow = new Error(`${a}-${b}-${c}-${cb}`);
throw errToThrow;

View File

@ -94,7 +94,9 @@ export default class Buffer extends Uint8Array {
if (typeof fill === "string") {
encoding = checkEncoding(encoding);
if (
typeof fill === "string" && fill.length === 1 && encoding === "utf8"
typeof fill === "string" &&
fill.length === 1 &&
encoding === "utf8"
) {
buf.fill(fill.charCodeAt(0));
} else bufFill = Buffer.from(fill, encoding);
@ -221,7 +223,7 @@ export default class Buffer extends Uint8Array {
/**
* Returns true if obj is a Buffer, false otherwise.
*/
static isBuffer(obj: object): obj is Buffer {
static isBuffer(obj: unknown): obj is Buffer {
return obj instanceof Buffer;
}
@ -408,7 +410,7 @@ export default class Buffer extends Uint8Array {
* Returns a JSON representation of buf. JSON.stringify() implicitly calls
* this function when stringifying a Buffer instance.
*/
toJSON(): object {
toJSON(): Record<string, unknown> {
return { type: "Buffer", data: Array.from(this) };
}

View File

@ -24,8 +24,11 @@
import { validateIntegerRange } from "./util.ts";
import { assert } from "../_util/assert.ts";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type GenericFunction = (...args: any[]) => any;
export interface WrappedFunction extends Function {
listener: Function;
listener: GenericFunction;
}
/**
@ -35,7 +38,10 @@ export default class EventEmitter {
public static defaultMaxListeners = 10;
public static errorMonitor = Symbol("events.errorMonitor");
private maxListeners: number | undefined;
private _events: Map<string | symbol, Array<Function | WrappedFunction>>;
private _events: Map<
string | symbol,
Array<GenericFunction | WrappedFunction>
>;
public constructor() {
this._events = new Map();
@ -43,13 +49,13 @@ export default class EventEmitter {
private _addListener(
eventName: string | symbol,
listener: Function | WrappedFunction,
listener: GenericFunction | WrappedFunction,
prepend: boolean,
): this {
this.emit("newListener", eventName, listener);
if (this._events.has(eventName)) {
const listeners = this._events.get(eventName) as Array<
Function | WrappedFunction
GenericFunction | WrappedFunction
>;
if (prepend) {
listeners.unshift(listener);
@ -76,7 +82,7 @@ export default class EventEmitter {
/** Alias for emitter.on(eventName, listener). */
public addListener(
eventName: string | symbol,
listener: Function | WrappedFunction,
listener: GenericFunction | WrappedFunction,
): this {
return this._addListener(eventName, listener, false);
}
@ -96,7 +102,9 @@ export default class EventEmitter {
) {
this.emit(EventEmitter.errorMonitor, ...args);
}
const listeners = (this._events.get(eventName) as Function[]).slice(); // We copy with slice() so array is not mutated during emit
const listeners = (this._events.get(
eventName,
) as GenericFunction[]).slice(); // We copy with slice() so array is not mutated during emit
for (const listener of listeners) {
try {
listener.apply(this, args);
@ -138,7 +146,7 @@ export default class EventEmitter {
*/
public listenerCount(eventName: string | symbol): number {
if (this._events.has(eventName)) {
return (this._events.get(eventName) as Function[]).length;
return (this._events.get(eventName) as GenericFunction[]).length;
} else {
return 0;
}
@ -148,21 +156,19 @@ export default class EventEmitter {
target: EventEmitter,
eventName: string | symbol,
unwrap: boolean,
): Function[] {
): GenericFunction[] {
if (!target._events.has(eventName)) {
return [];
}
const eventListeners: Function[] = target._events.get(
eventName,
) as Function[];
const eventListeners = target._events.get(eventName) as GenericFunction[];
return unwrap
? this.unwrapListeners(eventListeners)
: eventListeners.slice(0);
}
private unwrapListeners(arr: Function[]): Function[] {
const unwrappedListeners: Function[] = new Array(arr.length) as Function[];
private unwrapListeners(arr: GenericFunction[]): GenericFunction[] {
const unwrappedListeners = new Array(arr.length) as GenericFunction[];
for (let i = 0; i < arr.length; i++) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
unwrappedListeners[i] = (arr[i] as any)["listener"] || arr[i];
@ -171,7 +177,7 @@ export default class EventEmitter {
}
/** Returns a copy of the array of listeners for the event named eventName.*/
public listeners(eventName: string | symbol): Function[] {
public listeners(eventName: string | symbol): GenericFunction[] {
return this._listeners(this, eventName, true);
}
@ -181,12 +187,12 @@ export default class EventEmitter {
*/
public rawListeners(
eventName: string | symbol,
): Array<Function | WrappedFunction> {
): Array<GenericFunction | WrappedFunction> {
return this._listeners(this, eventName, false);
}
/** Alias for emitter.removeListener(). */
public off(eventName: string | symbol, listener: Function): this {
public off(eventName: string | symbol, listener: GenericFunction): this {
return this.removeListener(eventName, listener);
}
@ -199,7 +205,7 @@ export default class EventEmitter {
*/
public on(
eventName: string | symbol,
listener: Function | WrappedFunction,
listener: GenericFunction | WrappedFunction,
): this {
return this.addListener(eventName, listener);
}
@ -208,7 +214,7 @@ export default class EventEmitter {
* Adds a one-time listener function for the event named eventName. The next
* time eventName is triggered, this listener is removed and then invoked.
*/
public once(eventName: string | symbol, listener: Function): this {
public once(eventName: string | symbol, listener: GenericFunction): this {
const wrapped: WrappedFunction = this.onceWrap(eventName, listener);
this.on(eventName, wrapped);
return this;
@ -217,19 +223,22 @@ export default class EventEmitter {
// Wrapped function that calls EventEmitter.removeListener(eventName, self) on execution.
private onceWrap(
eventName: string | symbol,
listener: Function,
listener: GenericFunction,
): WrappedFunction {
const wrapper = function (
this: {
eventName: string | symbol;
listener: Function;
rawListener: Function;
listener: GenericFunction;
rawListener: GenericFunction | WrappedFunction;
context: EventEmitter;
},
// eslint-disable-next-line @typescript-eslint/no-explicit-any
...args: any[]
): void {
this.context.removeListener(this.eventName, this.rawListener);
this.context.removeListener(
this.eventName,
this.rawListener as GenericFunction,
);
this.listener.apply(this.context, args);
};
const wrapperContext = {
@ -255,7 +264,7 @@ export default class EventEmitter {
*/
public prependListener(
eventName: string | symbol,
listener: Function | WrappedFunction,
listener: GenericFunction | WrappedFunction,
): this {
return this._addListener(eventName, listener, true);
}
@ -267,7 +276,7 @@ export default class EventEmitter {
*/
public prependOnceListener(
eventName: string | symbol,
listener: Function,
listener: GenericFunction,
): this {
const wrapped: WrappedFunction = this.onceWrap(eventName, listener);
this.prependListener(eventName, wrapped);
@ -283,7 +292,7 @@ export default class EventEmitter {
if (eventName) {
if (this._events.has(eventName)) {
const listeners = (this._events.get(eventName) as Array<
Function | WrappedFunction
GenericFunction | WrappedFunction
>).slice(); // Create a copy; We use it AFTER it's deleted.
this._events.delete(eventName);
for (const listener of listeners) {
@ -304,10 +313,13 @@ export default class EventEmitter {
* Removes the specified listener from the listener array for the event
* named eventName.
*/
public removeListener(eventName: string | symbol, listener: Function): this {
public removeListener(
eventName: string | symbol,
listener: GenericFunction,
): this {
if (this._events.has(eventName)) {
const arr:
| Array<Function | WrappedFunction>
| Array<GenericFunction | WrappedFunction>
| undefined = this._events.get(eventName);
assert(arr);
@ -382,7 +394,7 @@ export function once(
}
resolve(args);
};
let errorListener: Function;
let errorListener: GenericFunction;
// Adding an error listener is not optional because
// if an error is thrown on an event emitter we cannot

View File

@ -6,7 +6,7 @@ import {
} from "../testing/asserts.ts";
import EventEmitter, { WrappedFunction, once, on } from "./events.ts";
const shouldNeverBeEmitted: Function = () => {
const shouldNeverBeEmitted = () => {
fail("Should never be called");
};

View File

@ -42,6 +42,7 @@ export const process = {
/** https://nodejs.org/api/process.html#process_process_events */
// on is not exported by node, it is only available within process:
// node --input-type=module -e "import { on } from 'process'; console.log(on)"
// eslint-disable-next-line @typescript-eslint/ban-types
on(_event: string, _callback: Function): void {
// TODO(rsp): to be implemented
notImplemented();

View File

@ -107,7 +107,8 @@ export function encodeStr(
}
export function stringify(
obj: object,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
obj: Record<string, any>,
sep = "&",
eq = "=",
{ encodeURIComponent = escape }: StringifyOptions = {},

View File

@ -301,7 +301,9 @@ const createHeader = (): string[] => [
"",
"",
` ${gray(bold("[Diff]"))} ${red(bold("Actual"))} / ${
green(bold("Expected"))
green(
bold("Expected"),
)
}`,
"",
"",
@ -484,10 +486,7 @@ Deno.test({
Deno.test({
name: "strictly unequal fail case",
fn(): void {
assertThrows(
() => assertNotStrictEquals(1, 1),
AssertionError,
);
assertThrows(() => assertNotStrictEquals(1, 1), AssertionError);
},
});
@ -499,6 +498,7 @@ Deno.test({
assertArrayContains<boolean>([true, false], [true]);
const value = { x: 1 };
assertStrictEquals<typeof value>(value, value);
// eslint-disable-next-line @typescript-eslint/ban-types
assertNotStrictEquals<object>(value, { x: 1 });
},
});

View File

@ -1,4 +1,5 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { assert } from "../_util/assert.ts";
import { deepAssign } from "../_util/deep_assign.ts";
interface BenchmarkClock {
@ -70,11 +71,11 @@ export interface BenchmarkRunResult {
/** Defines the current progress during the run of `runBenchmarks` */
export interface BenchmarkRunProgress extends BenchmarkRunResult {
/** List of the queued benchmarks to run with their name and their run count */
queued: Array<{ name: string; runsCount: number }>;
queued?: Array<{ name: string; runsCount: number }>;
/** The currently running benchmark with its name, run count and the already finished measurements in milliseconds */
running?: { name: string; runsCount: number; measuredRunsMs: number[] };
/** Indicates in which state benchmarking currently is */
state: ProgressState;
state?: ProgressState;
}
/** Defines the states `BenchmarkRunProgress` can be in */
@ -232,6 +233,7 @@ export async function runBenchmarks(
clock.for = name;
// Remove benchmark from queued
assert(progress.queued);
const queueIndex = progress.queued.findIndex(
(queued) => queued.name === name && queued.runsCount === runs,
);

View File

@ -255,6 +255,7 @@ Deno.test({
let pc = 0;
// Assert initial progress before running
let progress = progressCallbacks[pc++];
assert(progress.queued);
assertEquals(progress.state, ProgressState.BenchmarkingStart);
assertEquals(progress.filtered, 1);
assertEquals(progress.queued.length, 2);
@ -265,6 +266,7 @@ Deno.test({
progress = progressCallbacks[pc++];
assertEquals(progress.state, ProgressState.BenchStart);
assertEquals(progress.filtered, 1);
assert(progress.queued);
assertEquals(progress.queued.length, 1);
assert(!!progress.queued.find(({ name }) => name == "multiple"));
assertEquals(progress.running, {
@ -277,6 +279,7 @@ Deno.test({
// Assert running result of bench "single"
progress = progressCallbacks[pc++];
assertEquals(progress.state, ProgressState.BenchPartialResult);
assert(progress.queued);
assertEquals(progress.queued.length, 1);
assertEquals(progress.running!.measuredRunsMs.length, 1);
assertEquals(progress.results.length, 0);
@ -284,6 +287,7 @@ Deno.test({
// Assert result of bench "single"
progress = progressCallbacks[pc++];
assertEquals(progress.state, ProgressState.BenchResult);
assert(progress.queued);
assertEquals(progress.queued.length, 1);
assertEquals(progress.running, undefined);
assertEquals(progress.results.length, 1);
@ -292,6 +296,7 @@ Deno.test({
// Assert start of bench "multiple"
progress = progressCallbacks[pc++];
assertEquals(progress.state, ProgressState.BenchStart);
assert(progress.queued);
assertEquals(progress.queued.length, 0);
assertEquals(progress.running, {
name: "multiple",
@ -303,6 +308,7 @@ Deno.test({
// Assert first result of bench "multiple"
progress = progressCallbacks[pc++];
assertEquals(progress.state, ProgressState.BenchPartialResult);
assert(progress.queued);
assertEquals(progress.queued.length, 0);
assertEquals(progress.running!.measuredRunsMs.length, 1);
assertEquals(progress.results.length, 1);
@ -310,6 +316,7 @@ Deno.test({
// Assert second result of bench "multiple"
progress = progressCallbacks[pc++];
assertEquals(progress.state, ProgressState.BenchPartialResult);
assert(progress.queued);
assertEquals(progress.queued.length, 0);
assertEquals(progress.running!.measuredRunsMs.length, 2);
assertEquals(progress.results.length, 1);
@ -317,6 +324,7 @@ Deno.test({
// Assert finish of bench "multiple"
progress = progressCallbacks[pc++];
assertEquals(progress.state, ProgressState.BenchResult);
assert(progress.queued);
assertEquals(progress.queued.length, 0);
assertEquals(progress.running, undefined);
assertEquals(progress.results.length, 2);

@ -1 +1 @@
Subproject commit 581cc9d4f63b0a9032adb8f0617cf64a75b1e4a5
Subproject commit e80050929aec91d594d68fc01f3919de70a1dc3d