summaryrefslogtreecommitdiff
path: root/cli/tsc/dts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tsc/dts')
-rw-r--r--cli/tsc/dts/lib.deno.shared_globals.d.ts112
-rw-r--r--cli/tsc/dts/lib.deno.unstable.d.ts13
-rw-r--r--cli/tsc/dts/lib.deno.window.d.ts40
-rw-r--r--cli/tsc/dts/lib.deno.worker.d.ts46
-rw-r--r--cli/tsc/dts/lib.dom.extras.d.ts59
5 files changed, 214 insertions, 56 deletions
diff --git a/cli/tsc/dts/lib.deno.shared_globals.d.ts b/cli/tsc/dts/lib.deno.shared_globals.d.ts
index d11e2933b..49b6f7956 100644
--- a/cli/tsc/dts/lib.deno.shared_globals.d.ts
+++ b/cli/tsc/dts/lib.deno.shared_globals.d.ts
@@ -410,7 +410,7 @@ declare function clearInterval(id?: number): void;
declare function clearTimeout(id?: number): void;
/** @category Scheduling */
-interface VoidFunction {
+declare interface VoidFunction {
(): void;
}
@@ -442,7 +442,7 @@ declare function queueMicrotask(func: VoidFunction): void;
declare function dispatchEvent(event: Event): boolean;
/** @category DOM APIs */
-interface DOMStringList {
+declare interface DOMStringList {
/** Returns the number of strings in strings. */
readonly length: number;
/** Returns true if strings contains string, and false otherwise. */
@@ -453,13 +453,13 @@ interface DOMStringList {
}
/** @category Typed Arrays */
-type BufferSource = ArrayBufferView | ArrayBuffer;
+declare type BufferSource = ArrayBufferView | ArrayBuffer;
/** @category Console and Debugging */
declare var console: Console;
/** @category DOM Events */
-interface ErrorEventInit extends EventInit {
+declare interface ErrorEventInit extends EventInit {
message?: string;
filename?: string;
lineno?: number;
@@ -468,54 +468,63 @@ interface ErrorEventInit extends EventInit {
}
/** @category DOM Events */
-declare class ErrorEvent extends Event {
+declare interface ErrorEvent extends Event {
readonly message: string;
readonly filename: string;
readonly lineno: number;
readonly colno: number;
readonly error: any;
- constructor(type: string, eventInitDict?: ErrorEventInit);
}
+/** @category DOM Events */
+declare var ErrorEvent: {
+ readonly prototype: ErrorEvent;
+ new (type: string, eventInitDict?: ErrorEventInit): ErrorEvent;
+};
+
/** @category Observability */
-interface PromiseRejectionEventInit extends EventInit {
+declare interface PromiseRejectionEventInit extends EventInit {
promise: Promise<any>;
reason?: any;
}
/** @category Observability */
-declare class PromiseRejectionEvent extends Event {
+declare interface PromiseRejectionEvent extends Event {
readonly promise: Promise<any>;
readonly reason: any;
- constructor(type: string, eventInitDict?: PromiseRejectionEventInit);
}
+/** @category Observability */
+declare var PromiseRejectionEvent: {
+ readonly prototype: PromiseRejectionEvent;
+ new (
+ type: string,
+ eventInitDict?: PromiseRejectionEventInit,
+ ): PromiseRejectionEvent;
+};
+
/** @category Web Workers */
-interface AbstractWorkerEventMap {
+declare interface AbstractWorkerEventMap {
"error": ErrorEvent;
}
/** @category Web Workers */
-interface WorkerEventMap extends AbstractWorkerEventMap {
+declare interface WorkerEventMap extends AbstractWorkerEventMap {
"message": MessageEvent;
"messageerror": MessageEvent;
}
/** @category Web Workers */
-interface WorkerOptions {
+declare interface WorkerOptions {
type?: "classic" | "module";
name?: string;
}
/** @category Web Workers */
-declare class Worker extends EventTarget {
+declare interface Worker extends EventTarget {
onerror?: (e: ErrorEvent) => void;
onmessage?: (e: MessageEvent) => void;
onmessageerror?: (e: MessageEvent) => void;
- constructor(
- specifier: string | URL,
- options?: WorkerOptions,
- );
postMessage(message: any, transfer: Transferable[]): void;
postMessage(message: any, options?: StructuredSerializeOptions): void;
addEventListener<K extends keyof WorkerEventMap>(
@@ -541,14 +550,19 @@ declare class Worker extends EventTarget {
terminate(): void;
}
+/** @category Web Workers */
+declare var Worker: {
+ readonly prototype: Worker;
+ new (specifier: string | URL, options?: WorkerOptions): Worker;
+};
+
/** @category Performance */
declare type PerformanceEntryList = PerformanceEntry[];
/** @category Performance */
-declare class Performance extends EventTarget {
+declare interface Performance extends EventTarget {
/** Returns a timestamp representing the start of the performance measurement. */
readonly timeOrigin: number;
- constructor();
/** Removes the stored timestamp with the associated name. */
clearMarks(markName?: string): void;
@@ -595,6 +609,12 @@ declare class Performance extends EventTarget {
}
/** @category Performance */
+declare var Performance: {
+ readonly prototype: Performance;
+ new (): never;
+};
+
+/** @category Performance */
declare var performance: Performance;
/** @category Performance */
@@ -628,7 +648,7 @@ declare interface PerformanceMeasureOptions {
*
* @category Performance
*/
-declare class PerformanceEntry {
+declare interface PerformanceEntry {
readonly duration: number;
readonly entryType: string;
readonly name: string;
@@ -636,6 +656,18 @@ declare class PerformanceEntry {
toJSON(): any;
}
+/** Encapsulates a single performance metric that is part of the performance
+ * timeline. A performance entry can be directly created by making a performance
+ * mark or measure (for example by calling the `.mark()` method) at an explicit
+ * point in an application.
+ *
+ * @category Performance
+ */
+declare var PerformanceEntry: {
+ readonly prototype: PerformanceEntry;
+ new (): never;
+};
+
/** `PerformanceMark` is an abstract interface for `PerformanceEntry` objects
* with an entryType of `"mark"`. Entries of this type are created by calling
* `performance.mark()` to add a named `DOMHighResTimeStamp` (the mark) to the
@@ -643,12 +675,23 @@ declare class PerformanceEntry {
*
* @category Performance
*/
-declare class PerformanceMark extends PerformanceEntry {
+declare interface PerformanceMark extends PerformanceEntry {
readonly detail: any;
readonly entryType: "mark";
- constructor(name: string, options?: PerformanceMarkOptions);
}
+/** `PerformanceMark` is an abstract interface for `PerformanceEntry` objects
+ * with an entryType of `"mark"`. Entries of this type are created by calling
+ * `performance.mark()` to add a named `DOMHighResTimeStamp` (the mark) to the
+ * performance timeline.
+ *
+ * @category Performance
+ */
+declare var PerformanceMark: {
+ readonly prototype: PerformanceMark;
+ new (name: string, options?: PerformanceMarkOptions): PerformanceMark;
+};
+
/** `PerformanceMeasure` is an abstract interface for `PerformanceEntry` objects
* with an entryType of `"measure"`. Entries of this type are created by calling
* `performance.measure()` to add a named `DOMHighResTimeStamp` (the measure)
@@ -656,26 +699,43 @@ declare class PerformanceMark extends PerformanceEntry {
*
* @category Performance
*/
-declare class PerformanceMeasure extends PerformanceEntry {
+declare interface PerformanceMeasure extends PerformanceEntry {
readonly detail: any;
readonly entryType: "measure";
}
+/** `PerformanceMeasure` is an abstract interface for `PerformanceEntry` objects
+ * with an entryType of `"measure"`. Entries of this type are created by calling
+ * `performance.measure()` to add a named `DOMHighResTimeStamp` (the measure)
+ * between two marks to the performance timeline.
+ *
+ * @category Performance
+ */
+declare var PerformanceMeasure: {
+ readonly prototype: PerformanceMeasure;
+ new (): never;
+};
+
/** @category DOM Events */
declare interface CustomEventInit<T = any> extends EventInit {
detail?: T;
}
/** @category DOM Events */
-declare class CustomEvent<T = any> extends Event {
- constructor(typeArg: string, eventInitDict?: CustomEventInit<T>);
+declare interface CustomEvent<T = any> extends Event {
/** Returns any custom data event was created with. Typically used for
* synthetic events. */
readonly detail: T;
}
+/** @category DOM Events */
+declare var CustomEvent: {
+ readonly prototype: CustomEvent;
+ new <T>(typeArg: string, eventInitDict?: CustomEventInit<T>): CustomEvent<T>;
+};
+
/** @category DOM APIs */
-interface ErrorConstructor {
+declare interface ErrorConstructor {
/** See https://v8.dev/docs/stack-trace-api#stack-trace-collection-for-custom-exceptions. */
captureStackTrace(error: Object, constructor?: Function): void;
// TODO(nayeemrmn): Support `Error.prepareStackTrace()`. We currently use this
diff --git a/cli/tsc/dts/lib.deno.unstable.d.ts b/cli/tsc/dts/lib.deno.unstable.d.ts
index 8f11adfff..bc770dab8 100644
--- a/cli/tsc/dts/lib.deno.unstable.d.ts
+++ b/cli/tsc/dts/lib.deno.unstable.d.ts
@@ -2268,10 +2268,19 @@ declare interface WebSocketCloseInfo {
* @tags allow-net
* @category Web Sockets
*/
-declare class WebSocketStream {
- constructor(url: string, options?: WebSocketStreamOptions);
+declare interface WebSocketStream {
url: string;
connection: Promise<WebSocketConnection>;
closed: Promise<WebSocketCloseInfo>;
close(closeInfo?: WebSocketCloseInfo): void;
}
+
+/** **UNSTABLE**: New API, yet to be vetted.
+ *
+ * @tags allow-net
+ * @category Web Sockets
+ */
+declare var WebSocketStream: {
+ readonly prototype: WebSocketStream;
+ new (url: string, options?: WebSocketStreamOptions): WebSocketStream;
+};
diff --git a/cli/tsc/dts/lib.deno.window.d.ts b/cli/tsc/dts/lib.deno.window.d.ts
index d0cd9b5bd..2edb2ce8f 100644
--- a/cli/tsc/dts/lib.deno.window.d.ts
+++ b/cli/tsc/dts/lib.deno.window.d.ts
@@ -8,14 +8,13 @@
/// <reference lib="deno.cache" />
/** @category Web APIs */
-interface WindowEventMap {
+declare interface WindowEventMap {
"error": ErrorEvent;
"unhandledrejection": PromiseRejectionEvent;
}
/** @category Web APIs */
-declare class Window extends EventTarget {
- new(): Window;
+declare interface Window extends EventTarget {
readonly window: Window & typeof globalThis;
readonly self: Window & typeof globalThis;
onerror: ((this: Window, ev: ErrorEvent) => any) | null;
@@ -68,9 +67,19 @@ declare class Window extends EventTarget {
}
/** @category Web APIs */
+declare var Window: {
+ readonly prototype: Window;
+ new (): never;
+};
+
+/** @category Web APIs */
declare var window: Window & typeof globalThis;
/** @category Web APIs */
declare var self: Window & typeof globalThis;
+/** @category Web APIs */
+declare var closed: boolean;
+/** @category Web APIs */
+declare function close(): void;
/** @category DOM Events */
declare var onerror: ((this: Window, ev: ErrorEvent) => any) | null;
/** @category DOM Events */
@@ -91,8 +100,7 @@ declare var sessionStorage: Storage;
declare var caches: CacheStorage;
/** @category Web APIs */
-declare class Navigator {
- constructor();
+declare interface Navigator {
readonly hardwareConcurrency: number;
readonly userAgent: string;
readonly language: string;
@@ -100,6 +108,12 @@ declare class Navigator {
}
/** @category Web APIs */
+declare var Navigator: {
+ readonly prototype: Navigator;
+ new (): never;
+};
+
+/** @category Web APIs */
declare var navigator: Navigator;
/**
@@ -199,8 +213,7 @@ declare function removeEventListener(
*
* @category Web APIs
*/
-declare class Location {
- constructor();
+declare interface Location {
/** Returns a DOMStringList object listing the origins of the ancestor
* browsing contexts, from the parent browsing context to the top-level
* browsing context.
@@ -264,5 +277,18 @@ declare class Location {
// TODO(nayeemrmn): Move this to `extensions/web` where its implementation is.
// The types there must first be split into window, worker and global types.
+/** The location (URL) of the object it is linked to. Changes done on it are
+ * reflected on the object it relates to. Accessible via
+ * `globalThis.location`.
+ *
+ * @category Web APIs
+ */
+declare var Location: {
+ readonly prototype: Location;
+ new (): never;
+};
+
+// TODO(nayeemrmn): Move this to `extensions/web` where its implementation is.
+// The types there must first be split into window, worker and global types.
/** @category Web APIs */
declare var location: Location;
diff --git a/cli/tsc/dts/lib.deno.worker.d.ts b/cli/tsc/dts/lib.deno.worker.d.ts
index 752a427c9..b165f2086 100644
--- a/cli/tsc/dts/lib.deno.worker.d.ts
+++ b/cli/tsc/dts/lib.deno.worker.d.ts
@@ -7,13 +7,13 @@
/// <reference lib="deno.cache" />
/** @category Web Workers */
-interface WorkerGlobalScopeEventMap {
+declare interface WorkerGlobalScopeEventMap {
"error": ErrorEvent;
"unhandledrejection": PromiseRejectionEvent;
}
/** @category Web Workers */
-declare class WorkerGlobalScope extends EventTarget {
+declare interface WorkerGlobalScope extends EventTarget {
readonly location: WorkerLocation;
readonly navigator: WorkerNavigator;
onerror: ((this: WorkerGlobalScope, ev: ErrorEvent) => any) | null;
@@ -54,9 +54,14 @@ declare class WorkerGlobalScope extends EventTarget {
caches: CacheStorage;
}
+/** @category Web Workers */
+declare var WorkerGlobalScope: {
+ readonly prototype: WorkerGlobalScope;
+ new (): never;
+};
+
/** @category Web APIs */
-declare class WorkerNavigator {
- constructor();
+declare interface WorkerNavigator {
readonly hardwareConcurrency: number;
readonly userAgent: string;
readonly language: string;
@@ -64,16 +69,23 @@ declare class WorkerNavigator {
}
/** @category Web APIs */
+declare var WorkerNavigator: {
+ readonly prototype: WorkerNavigator;
+ new (): never;
+};
+
+/** @category Web APIs */
declare var navigator: WorkerNavigator;
/** @category Web Workers */
-interface DedicatedWorkerGlobalScopeEventMap extends WorkerGlobalScopeEventMap {
+declare interface DedicatedWorkerGlobalScopeEventMap
+ extends WorkerGlobalScopeEventMap {
"message": MessageEvent;
"messageerror": MessageEvent;
}
/** @category Web APIs */
-declare class DedicatedWorkerGlobalScope extends WorkerGlobalScope {
+declare interface DedicatedWorkerGlobalScope extends WorkerGlobalScope {
readonly name: string;
onmessage:
| ((this: DedicatedWorkerGlobalScope, ev: MessageEvent) => any)
@@ -112,6 +124,12 @@ declare class DedicatedWorkerGlobalScope extends WorkerGlobalScope {
): void;
}
+/** @category Web APIs */
+declare var DedicatedWorkerGlobalScope: {
+ readonly prototype: DedicatedWorkerGlobalScope;
+ new (): never;
+};
+
/** @category Web Workers */
declare var name: string;
/** @category Web Workers */
@@ -186,8 +204,7 @@ declare function removeEventListener(
*
* @category Web APIs
*/
-declare class WorkerLocation {
- constructor();
+declare interface WorkerLocation {
readonly hash: string;
readonly host: string;
readonly hostname: string;
@@ -202,5 +219,18 @@ declare class WorkerLocation {
// TODO(nayeemrmn): Move this to `extensions/web` where its implementation is.
// The types there must first be split into window, worker and global types.
+/** The absolute location of the script executed by the Worker. Such an object
+ * is initialized for each worker and is available via the
+ * WorkerGlobalScope.location property obtained by calling self.location.
+ *
+ * @category Web APIs
+ */
+declare var WorkerLocation: {
+ readonly prototype: WorkerLocation;
+ new (): never;
+};
+
+// TODO(nayeemrmn): Move this to `extensions/web` where its implementation is.
+// The types there must first be split into window, worker and global types.
/** @category Web APIs */
declare var location: WorkerLocation;
diff --git a/cli/tsc/dts/lib.dom.extras.d.ts b/cli/tsc/dts/lib.dom.extras.d.ts
index 9116596a6..441eb9221 100644
--- a/cli/tsc/dts/lib.dom.extras.d.ts
+++ b/cli/tsc/dts/lib.dom.extras.d.ts
@@ -59,7 +59,7 @@ declare interface URLPatternResult {
* ```ts
* // Specify the pattern as structured data.
* const pattern = new URLPattern({ pathname: "/users/:user" });
- * const match = pattern.exec("/users/joe");
+ * const match = pattern.exec("https://blog.example.com/users/joe");
* console.log(match.pathname.groups.user); // joe
* ```
*
@@ -72,24 +72,23 @@ declare interface URLPatternResult {
*
* ```ts
* // Specify a relative string pattern with a base URL.
- * const pattern = new URLPattern("/:article", "https://blog.example.com");
- * console.log(pattern.test("https://blog.example.com/article")); // true
- * console.log(pattern.test("https://blog.example.com/article/123")); // false
+ * const pattern = new URLPattern("/article/:id", "https://blog.example.com");
+ * console.log(pattern.test("https://blog.example.com/article")); // false
+ * console.log(pattern.test("https://blog.example.com/article/123")); // true
* ```
*/
-declare class URLPattern {
- constructor(input: URLPatternInput, baseURL?: string);
-
+interface URLPattern {
/**
* Test if the given input matches the stored pattern.
*
- * The input can either be provided as a url string (with an optional base),
- * or as individual components in the form of an object.
+ * The input can either be provided as an absolute URL string with an optional base,
+ * relative URL string with a required base, or as individual components
+ * in the form of an `URLPatternInit` object.
*
* ```ts
* const pattern = new URLPattern("https://example.com/books/:id");
*
- * // Test a url string.
+ * // Test an absolute url string.
* console.log(pattern.test("https://example.com/books/123")); // true
*
* // Test a relative url with a base.
@@ -104,13 +103,14 @@ declare class URLPattern {
/**
* Match the given input against the stored pattern.
*
- * The input can either be provided as a url string (with an optional base),
- * or as individual components in the form of an object.
+ * The input can either be provided as an absolute URL string with an optional base,
+ * relative URL string with a required base, or as individual components
+ * in the form of an `URLPatternInit` object.
*
* ```ts
* const pattern = new URLPattern("https://example.com/books/:id");
*
- * // Match a url string.
+ * // Match an absolute url string.
* let match = pattern.exec("https://example.com/books/123");
* console.log(match.pathname.groups.id); // 123
*
@@ -143,6 +143,39 @@ declare class URLPattern {
readonly hash: string;
}
+/**
+ * The URLPattern API provides a web platform primitive for matching URLs based
+ * on a convenient pattern syntax.
+ *
+ * The syntax is based on path-to-regexp. Wildcards, named capture groups,
+ * regular groups, and group modifiers are all supported.
+ *
+ * ```ts
+ * // Specify the pattern as structured data.
+ * const pattern = new URLPattern({ pathname: "/users/:user" });
+ * const match = pattern.exec("https://blog.example.com/users/joe");
+ * console.log(match.pathname.groups.user); // joe
+ * ```
+ *
+ * ```ts
+ * // Specify a fully qualified string pattern.
+ * const pattern = new URLPattern("https://example.com/books/:id");
+ * console.log(pattern.test("https://example.com/books/123")); // true
+ * console.log(pattern.test("https://deno.land/books/123")); // false
+ * ```
+ *
+ * ```ts
+ * // Specify a relative string pattern with a base URL.
+ * const pattern = new URLPattern("/article/:id", "https://blog.example.com");
+ * console.log(pattern.test("https://blog.example.com/article")); // false
+ * console.log(pattern.test("https://blog.example.com/article/123")); // true
+ * ```
+ */
+declare var URLPattern: {
+ readonly prototype: URLPattern;
+ new (input: URLPatternInput, baseURL?: string): URLPattern;
+};
+
interface ErrorConstructor {
/** See https://v8.dev/docs/stack-trace-api#stack-trace-collection-for-custom-exceptions. */
captureStackTrace(error: Object, constructor?: Function): void;