mirror of
https://github.com/denoland/deno.git
synced 2025-03-04 01:44:26 -05:00
Remove __domTypes namespace (#4698)
This commit is contained in:
parent
8b4508338b
commit
2af9f5f2cf
4 changed files with 170 additions and 212 deletions
341
cli/js/lib.deno.shared_globals.d.ts
vendored
341
cli/js/lib.deno.shared_globals.d.ts
vendored
|
@ -9,16 +9,8 @@
|
||||||
/// <reference lib="deno.ns" />
|
/// <reference lib="deno.ns" />
|
||||||
/// <reference lib="esnext" />
|
/// <reference lib="esnext" />
|
||||||
|
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope
|
|
||||||
|
|
||||||
declare interface WindowOrWorkerGlobalScope {
|
|
||||||
ReadableStream: __domTypes.ReadableStreamConstructor;
|
|
||||||
location: __domTypes.Location;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This follows the WebIDL at: https://webassembly.github.io/spec/js-api/
|
// This follows the WebIDL at: https://webassembly.github.io/spec/js-api/
|
||||||
// and: https://webassembly.github.io/spec/web-api/
|
// and: https://webassembly.github.io/spec/web-api/
|
||||||
|
|
||||||
declare namespace WebAssembly {
|
declare namespace WebAssembly {
|
||||||
interface WebAssemblyInstantiatedSource {
|
interface WebAssemblyInstantiatedSource {
|
||||||
module: Module;
|
module: Module;
|
||||||
|
@ -203,8 +195,7 @@ declare function clearInterval(id?: number): void;
|
||||||
declare function queueMicrotask(func: Function): void;
|
declare function queueMicrotask(func: Function): void;
|
||||||
|
|
||||||
declare const console: Console;
|
declare const console: Console;
|
||||||
declare const location: __domTypes.Location;
|
declare const location: Location;
|
||||||
declare const ReadableStream: __domTypes.ReadableStreamConstructor;
|
|
||||||
|
|
||||||
declare function addEventListener(
|
declare function addEventListener(
|
||||||
type: string,
|
type: string,
|
||||||
|
@ -220,188 +211,170 @@ declare function removeEventListener(
|
||||||
options?: boolean | EventListenerOptions | undefined
|
options?: boolean | EventListenerOptions | undefined
|
||||||
): void;
|
): void;
|
||||||
|
|
||||||
declare type ReadableStream<R = any> = __domTypes.ReadableStream<R>;
|
|
||||||
|
|
||||||
declare interface ImportMeta {
|
declare interface ImportMeta {
|
||||||
url: string;
|
url: string;
|
||||||
main: boolean;
|
main: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare namespace __domTypes {
|
interface DomIterable<K, V> {
|
||||||
export interface DomIterable<K, V> {
|
keys(): IterableIterator<K>;
|
||||||
keys(): IterableIterator<K>;
|
values(): IterableIterator<V>;
|
||||||
values(): IterableIterator<V>;
|
entries(): IterableIterator<[K, V]>;
|
||||||
entries(): IterableIterator<[K, V]>;
|
[Symbol.iterator](): IterableIterator<[K, V]>;
|
||||||
[Symbol.iterator](): IterableIterator<[K, V]>;
|
forEach(
|
||||||
forEach(
|
callback: (value: V, key: K, parent: this) => void,
|
||||||
callback: (value: V, key: K, parent: this) => void,
|
thisArg?: any
|
||||||
thisArg?: any
|
): void;
|
||||||
): void;
|
}
|
||||||
}
|
|
||||||
export interface ReadableStreamReadDoneResult<T> {
|
|
||||||
done: true;
|
|
||||||
value?: T;
|
|
||||||
}
|
|
||||||
export interface ReadableStreamReadValueResult<T> {
|
|
||||||
done: false;
|
|
||||||
value: T;
|
|
||||||
}
|
|
||||||
export type ReadableStreamReadResult<T> =
|
|
||||||
| ReadableStreamReadValueResult<T>
|
|
||||||
| ReadableStreamReadDoneResult<T>;
|
|
||||||
export interface ReadableStreamDefaultReader<R = any> {
|
|
||||||
readonly closed: Promise<void>;
|
|
||||||
cancel(reason?: any): Promise<void>;
|
|
||||||
read(): Promise<ReadableStreamReadResult<R>>;
|
|
||||||
releaseLock(): void;
|
|
||||||
}
|
|
||||||
export interface UnderlyingSource<R = any> {
|
|
||||||
cancel?: ReadableStreamErrorCallback;
|
|
||||||
pull?: ReadableStreamDefaultControllerCallback<R>;
|
|
||||||
start?: ReadableStreamDefaultControllerCallback<R>;
|
|
||||||
type?: undefined;
|
|
||||||
}
|
|
||||||
export interface ReadableStreamErrorCallback {
|
|
||||||
(reason: any): void | PromiseLike<void>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ReadableStreamDefaultControllerCallback<R> {
|
interface ReadableStreamReadDoneResult<T> {
|
||||||
(controller: ReadableStreamDefaultController<R>): void | PromiseLike<void>;
|
done: true;
|
||||||
}
|
value?: T;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ReadableStreamDefaultController<R> {
|
interface ReadableStreamReadValueResult<T> {
|
||||||
readonly desiredSize: number;
|
done: false;
|
||||||
enqueue(chunk?: R): void;
|
value: T;
|
||||||
close(): void;
|
}
|
||||||
error(e?: any): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This Streams API interface represents a readable stream of byte data. The
|
type ReadableStreamReadResult<T> =
|
||||||
* Fetch API offers a concrete instance of a ReadableStream through the body
|
| ReadableStreamReadValueResult<T>
|
||||||
* property of a Response object. */
|
| ReadableStreamReadDoneResult<T>;
|
||||||
export interface ReadableStream<R = any> {
|
|
||||||
readonly locked: boolean;
|
|
||||||
cancel(reason?: any): Promise<void>;
|
|
||||||
getReader(options: { mode: "byob" }): ReadableStreamBYOBReader;
|
|
||||||
getReader(): ReadableStreamDefaultReader<R>;
|
|
||||||
/* disabled for now
|
|
||||||
pipeThrough<T>(
|
|
||||||
{
|
|
||||||
writable,
|
|
||||||
readable
|
|
||||||
}: {
|
|
||||||
writable: WritableStream<R>;
|
|
||||||
readable: ReadableStream<T>;
|
|
||||||
},
|
|
||||||
options?: PipeOptions
|
|
||||||
): ReadableStream<T>;
|
|
||||||
pipeTo(dest: WritableStream<R>, options?: PipeOptions): Promise<void>;
|
|
||||||
*/
|
|
||||||
tee(): [ReadableStream<R>, ReadableStream<R>];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ReadableStreamConstructor<R = any> {
|
interface ReadableStreamDefaultReader<R = any> {
|
||||||
new (src?: UnderlyingSource<R>): ReadableStream<R>;
|
readonly closed: Promise<void>;
|
||||||
prototype: ReadableStream<R>;
|
cancel(reason?: any): Promise<void>;
|
||||||
}
|
read(): Promise<ReadableStreamReadResult<R>>;
|
||||||
|
releaseLock(): void;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ReadableStreamReader<R = any> {
|
interface UnderlyingSource<R = any> {
|
||||||
cancel(reason: any): Promise<void>;
|
cancel?: ReadableStreamErrorCallback;
|
||||||
read(): Promise<ReadableStreamReadResult<R>>;
|
pull?: ReadableStreamDefaultControllerCallback<R>;
|
||||||
releaseLock(): void;
|
start?: ReadableStreamDefaultControllerCallback<R>;
|
||||||
}
|
type?: undefined;
|
||||||
export interface ReadableStreamBYOBReader {
|
}
|
||||||
readonly closed: Promise<void>;
|
|
||||||
cancel(reason?: any): Promise<void>;
|
interface ReadableStreamErrorCallback {
|
||||||
read<T extends ArrayBufferView>(
|
(reason: any): void | PromiseLike<void>;
|
||||||
view: T
|
}
|
||||||
): Promise<ReadableStreamReadResult<T>>;
|
|
||||||
releaseLock(): void;
|
interface ReadableStreamDefaultControllerCallback<R> {
|
||||||
}
|
(controller: ReadableStreamDefaultController<R>): void | PromiseLike<void>;
|
||||||
export interface WritableStream<W = any> {
|
}
|
||||||
readonly locked: boolean;
|
|
||||||
abort(reason?: any): Promise<void>;
|
interface ReadableStreamDefaultController<R> {
|
||||||
getWriter(): WritableStreamDefaultWriter<W>;
|
readonly desiredSize: number;
|
||||||
}
|
enqueue(chunk?: R): void;
|
||||||
export interface WritableStreamDefaultWriter<W = any> {
|
close(): void;
|
||||||
readonly closed: Promise<void>;
|
error(e?: any): void;
|
||||||
readonly desiredSize: number | null;
|
}
|
||||||
readonly ready: Promise<void>;
|
|
||||||
abort(reason?: any): Promise<void>;
|
/** This Streams API interface represents a readable stream of byte data. The
|
||||||
close(): Promise<void>;
|
* Fetch API offers a concrete instance of a ReadableStream through the body
|
||||||
releaseLock(): void;
|
* property of a Response object. */
|
||||||
write(chunk: W): Promise<void>;
|
interface ReadableStream<R = any> {
|
||||||
}
|
readonly locked: boolean;
|
||||||
export interface DOMStringList {
|
cancel(reason?: any): Promise<void>;
|
||||||
/** Returns the number of strings in strings. */
|
// TODO(ry) It doesn't seem like Chrome supports this.
|
||||||
readonly length: number;
|
// getReader(options: { mode: "byob" }): ReadableStreamBYOBReader;
|
||||||
/** Returns true if strings contains string, and false otherwise. */
|
getReader(): ReadableStreamDefaultReader<R>;
|
||||||
contains(string: string): boolean;
|
tee(): [ReadableStream<R>, ReadableStream<R>];
|
||||||
/** Returns the string with index index from strings. */
|
}
|
||||||
item(index: number): string | null;
|
|
||||||
[index: number]: string;
|
declare const ReadableStream: {
|
||||||
}
|
prototype: ReadableStream;
|
||||||
/** The location (URL) of the object it is linked to. Changes done on it are
|
// TODO(ry) This doesn't match lib.dom.d.ts
|
||||||
* reflected on the object it relates to. Both the Document and Window
|
new <R = any>(src?: UnderlyingSource<R>): ReadableStream<R>;
|
||||||
* interface have such a linked Location, accessible via Document.location and
|
};
|
||||||
* Window.location respectively. */
|
|
||||||
export interface Location {
|
/** This Streams API interface provides a standard abstraction for writing streaming data to a destination, known as a sink. This object comes with built-in backpressure and queuing. */
|
||||||
/** Returns a DOMStringList object listing the origins of the ancestor
|
interface WritableStream<W = any> {
|
||||||
* browsing contexts, from the parent browsing context to the top-level
|
readonly locked: boolean;
|
||||||
* browsing context. */
|
abort(reason?: any): Promise<void>;
|
||||||
readonly ancestorOrigins: DOMStringList;
|
getWriter(): WritableStreamDefaultWriter<W>;
|
||||||
/** Returns the Location object's URL's fragment (includes leading "#" if
|
}
|
||||||
* non-empty).
|
|
||||||
*
|
interface WritableStreamDefaultWriter<W = any> {
|
||||||
* Can be set, to navigate to the same URL with a changed fragment (ignores
|
readonly closed: Promise<void>;
|
||||||
* leading "#"). */
|
readonly desiredSize: number | null;
|
||||||
hash: string;
|
readonly ready: Promise<void>;
|
||||||
/** Returns the Location object's URL's host and port (if different from the
|
abort(reason?: any): Promise<void>;
|
||||||
* default port for the scheme).
|
close(): Promise<void>;
|
||||||
*
|
releaseLock(): void;
|
||||||
* Can be set, to navigate to the same URL with a changed host and port. */
|
write(chunk: W): Promise<void>;
|
||||||
host: string;
|
}
|
||||||
/** Returns the Location object's URL's host.
|
|
||||||
*
|
interface DOMStringList {
|
||||||
* Can be set, to navigate to the same URL with a changed host. */
|
/** Returns the number of strings in strings. */
|
||||||
hostname: string;
|
readonly length: number;
|
||||||
/** Returns the Location object's URL.
|
/** Returns true if strings contains string, and false otherwise. */
|
||||||
*
|
contains(string: string): boolean;
|
||||||
* Can be set, to navigate to the given URL. */
|
/** Returns the string with index index from strings. */
|
||||||
href: string;
|
item(index: number): string | null;
|
||||||
toString(): string;
|
[index: number]: string;
|
||||||
/** Returns the Location object's URL's origin. */
|
}
|
||||||
readonly origin: string;
|
|
||||||
/** Returns the Location object's URL's path.
|
/** The location (URL) of the object it is linked to. Changes done on it are
|
||||||
*
|
* reflected on the object it relates to. Both the Document and Window
|
||||||
* Can be set, to navigate to the same URL with a changed path. */
|
* interface have such a linked Location, accessible via Document.location and
|
||||||
pathname: string;
|
* Window.location respectively. */
|
||||||
/** Returns the Location object's URL's port.
|
declare interface Location {
|
||||||
*
|
/** Returns a DOMStringList object listing the origins of the ancestor
|
||||||
* Can be set, to navigate to the same URL with a changed port. */
|
* browsing contexts, from the parent browsing context to the top-level
|
||||||
port: string;
|
* browsing context. */
|
||||||
/** Returns the Location object's URL's scheme.
|
readonly ancestorOrigins: DOMStringList;
|
||||||
*
|
/** Returns the Location object's URL's fragment (includes leading "#" if
|
||||||
* Can be set, to navigate to the same URL with a changed scheme. */
|
* non-empty).
|
||||||
protocol: string;
|
*
|
||||||
/** Returns the Location object's URL's query (includes leading "?" if
|
* Can be set, to navigate to the same URL with a changed fragment (ignores
|
||||||
* non-empty).
|
* leading "#"). */
|
||||||
*
|
hash: string;
|
||||||
* Can be set, to navigate to the same URL with a changed query (ignores
|
/** Returns the Location object's URL's host and port (if different from the
|
||||||
* leading "?"). */
|
* default port for the scheme).
|
||||||
search: string;
|
*
|
||||||
/**
|
* Can be set, to navigate to the same URL with a changed host and port. */
|
||||||
* Navigates to the given URL.
|
host: string;
|
||||||
*/
|
/** Returns the Location object's URL's host.
|
||||||
assign(url: string): void;
|
*
|
||||||
/**
|
* Can be set, to navigate to the same URL with a changed host. */
|
||||||
* Reloads the current page.
|
hostname: string;
|
||||||
*/
|
/** Returns the Location object's URL.
|
||||||
reload(): void;
|
*
|
||||||
/** Removes the current page from the session history and navigates to the
|
* Can be set, to navigate to the given URL. */
|
||||||
* given URL. */
|
href: string;
|
||||||
replace(url: string): void;
|
toString(): string;
|
||||||
}
|
/** Returns the Location object's URL's origin. */
|
||||||
|
readonly origin: string;
|
||||||
|
/** Returns the Location object's URL's path.
|
||||||
|
*
|
||||||
|
* Can be set, to navigate to the same URL with a changed path. */
|
||||||
|
pathname: string;
|
||||||
|
/** Returns the Location object's URL's port.
|
||||||
|
*
|
||||||
|
* Can be set, to navigate to the same URL with a changed port. */
|
||||||
|
port: string;
|
||||||
|
/** Returns the Location object's URL's scheme.
|
||||||
|
*
|
||||||
|
* Can be set, to navigate to the same URL with a changed scheme. */
|
||||||
|
protocol: string;
|
||||||
|
/** Returns the Location object's URL's query (includes leading "?" if
|
||||||
|
* non-empty).
|
||||||
|
*
|
||||||
|
* Can be set, to navigate to the same URL with a changed query (ignores
|
||||||
|
* leading "?"). */
|
||||||
|
search: string;
|
||||||
|
/**
|
||||||
|
* Navigates to the given URL.
|
||||||
|
*/
|
||||||
|
assign(url: string): void;
|
||||||
|
/**
|
||||||
|
* Reloads the current page.
|
||||||
|
*/
|
||||||
|
reload(): void;
|
||||||
|
/** Removes the current page from the session history and navigates to the
|
||||||
|
* given URL. */
|
||||||
|
replace(url: string): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
type BufferSource = ArrayBufferView | ArrayBuffer;
|
type BufferSource = ArrayBufferView | ArrayBuffer;
|
||||||
|
@ -515,7 +488,7 @@ type FormDataEntryValue = File | string;
|
||||||
* form fields and their values, which can then be easily sent using the
|
* form fields and their values, which can then be easily sent using the
|
||||||
* XMLHttpRequest.send() method. It uses the same format a form would use if the
|
* XMLHttpRequest.send() method. It uses the same format a form would use if the
|
||||||
* encoding type were set to "multipart/form-data". */
|
* encoding type were set to "multipart/form-data". */
|
||||||
interface FormData extends __domTypes.DomIterable<string, FormDataEntryValue> {
|
interface FormData extends DomIterable<string, FormDataEntryValue> {
|
||||||
append(name: string, value: string | Blob, fileName?: string): void;
|
append(name: string, value: string | Blob, fileName?: string): void;
|
||||||
delete(name: string): void;
|
delete(name: string): void;
|
||||||
get(name: string): FormDataEntryValue | null;
|
get(name: string): FormDataEntryValue | null;
|
||||||
|
@ -581,7 +554,7 @@ interface Headers {
|
||||||
): void;
|
): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Headers extends __domTypes.DomIterable<string, string> {
|
interface Headers extends DomIterable<string, string> {
|
||||||
/** Appends a new value onto an existing header inside a `Headers` object, or
|
/** Appends a new value onto an existing header inside a `Headers` object, or
|
||||||
* adds the header if it does not already exist.
|
* adds the header if it does not already exist.
|
||||||
*/
|
*/
|
||||||
|
|
11
cli/js/lib.deno.window.d.ts
vendored
11
cli/js/lib.deno.window.d.ts
vendored
|
@ -7,19 +7,20 @@
|
||||||
/// <reference lib="deno.shared_globals" />
|
/// <reference lib="deno.shared_globals" />
|
||||||
/// <reference lib="esnext" />
|
/// <reference lib="esnext" />
|
||||||
|
|
||||||
declare interface Window extends WindowOrWorkerGlobalScope {
|
declare interface Window {
|
||||||
window: Window & WindowOrWorkerGlobalScope & typeof globalThis;
|
window: Window & typeof globalThis;
|
||||||
self: Window & WindowOrWorkerGlobalScope & typeof globalThis;
|
self: Window & typeof globalThis;
|
||||||
onload: Function | undefined;
|
onload: Function | undefined;
|
||||||
onunload: Function | undefined;
|
onunload: Function | undefined;
|
||||||
|
location: Location;
|
||||||
crypto: Crypto;
|
crypto: Crypto;
|
||||||
close: () => void;
|
close: () => void;
|
||||||
closed: boolean;
|
closed: boolean;
|
||||||
Deno: typeof Deno;
|
Deno: typeof Deno;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare const window: Window & WindowOrWorkerGlobalScope & typeof globalThis;
|
declare const window: Window & typeof globalThis;
|
||||||
declare const self: Window & WindowOrWorkerGlobalScope & typeof globalThis;
|
declare const self: Window & typeof globalThis;
|
||||||
declare const onload: Function | undefined;
|
declare const onload: Function | undefined;
|
||||||
declare const onunload: Function | undefined;
|
declare const onunload: Function | undefined;
|
||||||
declare const crypto: Crypto;
|
declare const crypto: Crypto;
|
||||||
|
|
14
cli/js/lib.deno.worker.d.ts
vendored
14
cli/js/lib.deno.worker.d.ts
vendored
|
@ -1,15 +1,13 @@
|
||||||
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-interface, @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any */
|
||||||
|
|
||||||
/// <reference no-default-lib="true" />
|
/// <reference no-default-lib="true" />
|
||||||
/// <reference lib="deno.shared_globals" />
|
/// <reference lib="deno.shared_globals" />
|
||||||
/// <reference lib="esnext" />
|
/// <reference lib="esnext" />
|
||||||
|
|
||||||
declare interface DedicatedWorkerGlobalScope extends WindowOrWorkerGlobalScope {
|
declare interface DedicatedWorkerGlobalScope {
|
||||||
self: DedicatedWorkerGlobalScope &
|
self: DedicatedWorkerGlobalScope & typeof globalThis;
|
||||||
WindowOrWorkerGlobalScope &
|
|
||||||
typeof globalThis;
|
|
||||||
onmessage: (e: { data: any }) => void;
|
onmessage: (e: { data: any }) => void;
|
||||||
onerror: undefined | typeof onerror;
|
onerror: undefined | typeof onerror;
|
||||||
name: typeof __workerMain.name;
|
name: typeof __workerMain.name;
|
||||||
|
@ -17,9 +15,7 @@ declare interface DedicatedWorkerGlobalScope extends WindowOrWorkerGlobalScope {
|
||||||
postMessage: typeof __workerMain.postMessage;
|
postMessage: typeof __workerMain.postMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare const self: DedicatedWorkerGlobalScope &
|
declare const self: DedicatedWorkerGlobalScope & typeof globalThis;
|
||||||
WindowOrWorkerGlobalScope &
|
|
||||||
typeof globalThis;
|
|
||||||
declare let onmessage: ((e: { data: any }) => Promise<void> | void) | undefined;
|
declare let onmessage: ((e: { data: any }) => Promise<void> | void) | undefined;
|
||||||
declare let onerror:
|
declare let onerror:
|
||||||
| ((
|
| ((
|
||||||
|
@ -41,4 +37,4 @@ declare namespace __workerMain {
|
||||||
export const name: string;
|
export const name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eslint-enable @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-interface, @typescript-eslint/no-explicit-any */
|
/* eslint-enable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any */
|
||||||
|
|
|
@ -1,16 +1,4 @@
|
||||||
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
||||||
[WILDCARD]
|
[WILDCARD]
|
||||||
|
declare namespace Deno [WILDCARD]
|
||||||
declare namespace Deno {
|
declare const window: Window [WILDCARD]
|
||||||
[WILDCARD]
|
|
||||||
}
|
|
||||||
[WILDCARD]
|
|
||||||
declare interface WindowOrWorkerGlobalScope {
|
|
||||||
[WILDCARD]
|
|
||||||
declare interface Window extends WindowOrWorkerGlobalScope {
|
|
||||||
[WILDCARD]
|
|
||||||
Deno: typeof Deno;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare const window: Window & WindowOrWorkerGlobalScope & typeof globalThis;
|
|
||||||
[WILDCARD]
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue