1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

chore: add code generation for @types/deno (#25545)

This commit is contained in:
David Sherret 2024-09-23 15:18:52 -04:00 committed by GitHub
parent e1c8d2755e
commit 33f169beb9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 485 additions and 356 deletions

View file

@ -10,7 +10,7 @@
* *
* @category Platform * @category Platform
*/ */
declare interface ImportMeta { interface ImportMeta {
/** A string representation of the fully qualified module URL. When the /** A string representation of the fully qualified module URL. When the
* module is loaded locally, the value will be a file URL (e.g. * module is loaded locally, the value will be a file URL (e.g.
* `file:///path/module.ts`). * `file:///path/module.ts`).
@ -89,7 +89,7 @@ declare interface ImportMeta {
* *
* @category Performance * @category Performance
*/ */
declare interface Performance { interface Performance {
/** Stores a timestamp with the associated name (a "mark"). */ /** Stores a timestamp with the associated name (a "mark"). */
mark(markName: string, options?: PerformanceMarkOptions): PerformanceMark; mark(markName: string, options?: PerformanceMarkOptions): PerformanceMark;
@ -109,7 +109,7 @@ declare interface Performance {
* *
* @category Performance * @category Performance
*/ */
declare interface PerformanceMarkOptions { interface PerformanceMarkOptions {
/** Metadata to be included in the mark. */ /** Metadata to be included in the mark. */
// deno-lint-ignore no-explicit-any // deno-lint-ignore no-explicit-any
detail?: any; detail?: any;
@ -126,7 +126,7 @@ declare interface PerformanceMarkOptions {
* *
* @category Performance * @category Performance
*/ */
declare interface PerformanceMeasureOptions { interface PerformanceMeasureOptions {
/** Metadata to be included in the measure. */ /** Metadata to be included in the measure. */
// deno-lint-ignore no-explicit-any // deno-lint-ignore no-explicit-any
detail?: any; detail?: any;
@ -317,6 +317,7 @@ declare namespace Deno {
* *
* @category Errors */ * @category Errors */
export class NotADirectory extends Error {} export class NotADirectory extends Error {}
/** /**
* Raised when trying to perform an operation while the relevant Deno * Raised when trying to perform an operation while the relevant Deno
* permission (like `--allow-read`) has not been granted. * permission (like `--allow-read`) has not been granted.
@ -326,6 +327,8 @@ declare namespace Deno {
* *
* @category Errors */ * @category Errors */
export class NotCapable extends Error {} export class NotCapable extends Error {}
export {}; // only export exports
} }
/** The current process ID of this instance of the Deno CLI. /** The current process ID of this instance of the Deno CLI.
@ -5407,7 +5410,9 @@ declare namespace Deno {
* *
* @category FFI * @category FFI
*/ */
export type NativeStructType = { readonly struct: readonly NativeType[] }; export interface NativeStructType {
readonly struct: readonly NativeType[];
}
/** /**
* @category FFI * @category FFI
@ -5700,7 +5705,9 @@ declare namespace Deno {
* *
* @category FFI * @category FFI
*/ */
export type PointerObject<T = unknown> = { [brand]: T }; export interface PointerObject<T = unknown> {
[brand]: T;
}
/** Pointers are represented either with a {@linkcode PointerObject} /** Pointers are represented either with a {@linkcode PointerObject}
* object or a `null` if the pointer is null. * object or a `null` if the pointer is null.
@ -6137,4 +6144,6 @@ declare namespace Deno {
| CreateHttpClientOptions | CreateHttpClientOptions
| (CreateHttpClientOptions & TlsCertifiedKeyPem), | (CreateHttpClientOptions & TlsCertifiedKeyPem),
): HttpClient; ): HttpClient;
export {}; // only export exports
} }

View file

@ -413,7 +413,7 @@ declare function clearInterval(id?: number): void;
declare function clearTimeout(id?: number): void; declare function clearTimeout(id?: number): void;
/** @category Platform */ /** @category Platform */
declare interface VoidFunction { interface VoidFunction {
(): void; (): void;
} }
@ -445,7 +445,7 @@ declare function queueMicrotask(func: VoidFunction): void;
declare function dispatchEvent(event: Event): boolean; declare function dispatchEvent(event: Event): boolean;
/** @category Platform */ /** @category Platform */
declare interface DOMStringList { interface DOMStringList {
/** Returns the number of strings in strings. */ /** Returns the number of strings in strings. */
readonly length: number; readonly length: number;
/** Returns true if strings contains string, and false otherwise. */ /** Returns true if strings contains string, and false otherwise. */
@ -456,13 +456,13 @@ declare interface DOMStringList {
} }
/** @category Platform */ /** @category Platform */
declare type BufferSource = ArrayBufferView | ArrayBuffer; type BufferSource = ArrayBufferView | ArrayBuffer;
/** @category I/O */ /** @category I/O */
declare var console: Console; declare var console: Console;
/** @category Events */ /** @category Events */
declare interface ErrorEventInit extends EventInit { interface ErrorEventInit extends EventInit {
message?: string; message?: string;
filename?: string; filename?: string;
lineno?: number; lineno?: number;
@ -471,7 +471,7 @@ declare interface ErrorEventInit extends EventInit {
} }
/** @category Events */ /** @category Events */
declare interface ErrorEvent extends Event { interface ErrorEvent extends Event {
readonly message: string; readonly message: string;
readonly filename: string; readonly filename: string;
readonly lineno: number; readonly lineno: number;
@ -486,13 +486,13 @@ declare var ErrorEvent: {
}; };
/** @category Events */ /** @category Events */
declare interface PromiseRejectionEventInit extends EventInit { interface PromiseRejectionEventInit extends EventInit {
promise: Promise<any>; promise: Promise<any>;
reason?: any; reason?: any;
} }
/** @category Events */ /** @category Events */
declare interface PromiseRejectionEvent extends Event { interface PromiseRejectionEvent extends Event {
readonly promise: Promise<any>; readonly promise: Promise<any>;
readonly reason: any; readonly reason: any;
} }
@ -507,24 +507,24 @@ declare var PromiseRejectionEvent: {
}; };
/** @category Workers */ /** @category Workers */
declare interface AbstractWorkerEventMap { interface AbstractWorkerEventMap {
"error": ErrorEvent; "error": ErrorEvent;
} }
/** @category Workers */ /** @category Workers */
declare interface WorkerEventMap extends AbstractWorkerEventMap { interface WorkerEventMap extends AbstractWorkerEventMap {
"message": MessageEvent; "message": MessageEvent;
"messageerror": MessageEvent; "messageerror": MessageEvent;
} }
/** @category Workers */ /** @category Workers */
declare interface WorkerOptions { interface WorkerOptions {
type?: "classic" | "module"; type?: "classic" | "module";
name?: string; name?: string;
} }
/** @category Workers */ /** @category Workers */
declare interface Worker extends EventTarget { interface Worker extends EventTarget {
onerror: (this: Worker, e: ErrorEvent) => any | null; onerror: (this: Worker, e: ErrorEvent) => any | null;
onmessage: (this: Worker, e: MessageEvent) => any | null; onmessage: (this: Worker, e: MessageEvent) => any | null;
onmessageerror: (this: Worker, e: MessageEvent) => any | null; onmessageerror: (this: Worker, e: MessageEvent) => any | null;
@ -560,10 +560,10 @@ declare var Worker: {
}; };
/** @category Performance */ /** @category Performance */
declare type PerformanceEntryList = PerformanceEntry[]; type PerformanceEntryList = PerformanceEntry[];
/** @category Performance */ /** @category Performance */
declare interface Performance extends EventTarget { interface Performance extends EventTarget {
/** Returns a timestamp representing the start of the performance measurement. */ /** Returns a timestamp representing the start of the performance measurement. */
readonly timeOrigin: number; readonly timeOrigin: number;
@ -617,7 +617,7 @@ declare var Performance: {
declare var performance: Performance; declare var performance: Performance;
/** @category Performance */ /** @category Performance */
declare interface PerformanceMarkOptions { interface PerformanceMarkOptions {
/** Metadata to be included in the mark. */ /** Metadata to be included in the mark. */
detail?: any; detail?: any;
@ -626,7 +626,7 @@ declare interface PerformanceMarkOptions {
} }
/** @category Performance */ /** @category Performance */
declare interface PerformanceMeasureOptions { interface PerformanceMeasureOptions {
/** Metadata to be included in the measure. */ /** Metadata to be included in the measure. */
detail?: any; detail?: any;
@ -648,7 +648,7 @@ declare interface PerformanceMeasureOptions {
* *
* @category Performance * @category Performance
*/ */
declare interface PerformanceEntry { interface PerformanceEntry {
readonly duration: number; readonly duration: number;
readonly entryType: string; readonly entryType: string;
readonly name: string; readonly name: string;
@ -675,7 +675,7 @@ declare var PerformanceEntry: {
* *
* @category Performance * @category Performance
*/ */
declare interface PerformanceMark extends PerformanceEntry { interface PerformanceMark extends PerformanceEntry {
readonly detail: any; readonly detail: any;
readonly entryType: "mark"; readonly entryType: "mark";
} }
@ -699,7 +699,7 @@ declare var PerformanceMark: {
* *
* @category Performance * @category Performance
*/ */
declare interface PerformanceMeasure extends PerformanceEntry { interface PerformanceMeasure extends PerformanceEntry {
readonly detail: any; readonly detail: any;
readonly entryType: "measure"; readonly entryType: "measure";
} }
@ -717,12 +717,12 @@ declare var PerformanceMeasure: {
}; };
/** @category Events */ /** @category Events */
declare interface CustomEventInit<T = any> extends EventInit { interface CustomEventInit<T = any> extends EventInit {
detail?: T; detail?: T;
} }
/** @category Events */ /** @category Events */
declare interface CustomEvent<T = any> extends Event { interface CustomEvent<T = any> extends Event {
/** Returns any custom data event was created with. Typically used for /** Returns any custom data event was created with. Typically used for
* synthetic events. */ * synthetic events. */
readonly detail: T; readonly detail: T;
@ -735,7 +735,7 @@ declare var CustomEvent: {
}; };
/** @category Platform */ /** @category Platform */
declare interface ErrorConstructor { interface ErrorConstructor {
/** See https://v8.dev/docs/stack-trace-api#stack-trace-collection-for-custom-exceptions. */ /** See https://v8.dev/docs/stack-trace-api#stack-trace-collection-for-custom-exceptions. */
captureStackTrace(error: Object, constructor?: Function): void; captureStackTrace(error: Object, constructor?: Function): void;
// TODO(nayeemrmn): Support `Error.prepareStackTrace()`. We currently use this // TODO(nayeemrmn): Support `Error.prepareStackTrace()`. We currently use this

View file

@ -212,7 +212,7 @@ declare namespace Deno {
* @category Cloud * @category Cloud
* @experimental * @experimental
*/ */
export function openKv(path?: string): Promise<Deno.Kv>; export function openKv(path?: string): Promise<Kv>;
/** **UNSTABLE**: New API, yet to be vetted. /** **UNSTABLE**: New API, yet to be vetted.
* *
@ -475,7 +475,11 @@ declare namespace Deno {
* @category Cloud * @category Cloud
* @experimental * @experimental
*/ */
export type KvEntry<T> = { key: KvKey; value: T; versionstamp: string }; export interface KvEntry<T> {
key: KvKey;
value: T;
versionstamp: string;
}
/** /**
* **UNSTABLE**: New API, yet to be vetted. * **UNSTABLE**: New API, yet to be vetted.
@ -680,7 +684,7 @@ declare namespace Deno {
value: unknown, value: unknown,
options?: { options?: {
delay?: number; delay?: number;
keysIfUndelivered?: Deno.KvKey[]; keysIfUndelivered?: KvKey[];
backoffSchedule?: number[]; backoffSchedule?: number[];
}, },
): this; ): this;
@ -911,7 +915,7 @@ declare namespace Deno {
value: unknown, value: unknown,
options?: { options?: {
delay?: number; delay?: number;
keysIfUndelivered?: Deno.KvKey[]; keysIfUndelivered?: KvKey[];
backoffSchedule?: number[]; backoffSchedule?: number[];
}, },
): Promise<KvCommitResult>; ): Promise<KvCommitResult>;
@ -1041,10 +1045,10 @@ declare namespace Deno {
* @category Jupyter * @category Jupyter
* @experimental * @experimental
*/ */
export type VegaObject = { export interface VegaObject {
$schema: string; $schema: string;
[key: string]: unknown; [key: string]: unknown;
}; }
/** /**
* A collection of supported media types and data for Jupyter frontends. * A collection of supported media types and data for Jupyter frontends.
@ -1052,7 +1056,7 @@ declare namespace Deno {
* @category Jupyter * @category Jupyter
* @experimental * @experimental
*/ */
export type MediaBundle = { export interface MediaBundle {
"text/plain"?: string; "text/plain"?: string;
"text/html"?: string; "text/html"?: string;
"image/svg+xml"?: string; "image/svg+xml"?: string;
@ -1078,7 +1082,7 @@ declare namespace Deno {
// Must support a catch all for custom media types / mimetypes // Must support a catch all for custom media types / mimetypes
[key: string]: string | object | undefined; [key: string]: string | object | undefined;
}; }
/** /**
* @category Jupyter * @category Jupyter
@ -1090,9 +1094,9 @@ declare namespace Deno {
* @category Jupyter * @category Jupyter
* @experimental * @experimental
*/ */
export type Displayable = { export interface Displayable {
[$display]: () => MediaBundle | Promise<MediaBundle>; [$display]: () => MediaBundle | Promise<MediaBundle>;
}; }
/** /**
* Display function for Jupyter Deno Kernel. * Display function for Jupyter Deno Kernel.
@ -1217,7 +1221,11 @@ declare namespace Deno {
buffers?: Uint8Array[]; buffers?: Uint8Array[];
}, },
): Promise<void>; ): Promise<void>;
export {}; // only export exports
} }
export {}; // only export exports
} }
/** **UNSTABLE**: New API, yet to be vetted. /** **UNSTABLE**: New API, yet to be vetted.
@ -1225,7 +1233,7 @@ declare namespace Deno {
* @category Workers * @category Workers
* @experimental * @experimental
*/ */
declare interface WorkerOptions { interface WorkerOptions {
/** **UNSTABLE**: New API, yet to be vetted. /** **UNSTABLE**: New API, yet to be vetted.
* *
* Configure permissions options to change the level of access the worker will * Configure permissions options to change the level of access the worker will
@ -1266,7 +1274,7 @@ declare interface WorkerOptions {
* @category WebSockets * @category WebSockets
* @experimental * @experimental
*/ */
declare interface WebSocketStreamOptions { interface WebSocketStreamOptions {
protocols?: string[]; protocols?: string[];
signal?: AbortSignal; signal?: AbortSignal;
headers?: HeadersInit; headers?: HeadersInit;
@ -1277,7 +1285,7 @@ declare interface WebSocketStreamOptions {
* @category WebSockets * @category WebSockets
* @experimental * @experimental
*/ */
declare interface WebSocketConnection { interface WebSocketConnection {
readable: ReadableStream<string | Uint8Array>; readable: ReadableStream<string | Uint8Array>;
writable: WritableStream<string | Uint8Array>; writable: WritableStream<string | Uint8Array>;
extensions: string; extensions: string;
@ -1289,7 +1297,7 @@ declare interface WebSocketConnection {
* @category WebSockets * @category WebSockets
* @experimental * @experimental
*/ */
declare interface WebSocketCloseInfo { interface WebSocketCloseInfo {
code?: number; code?: number;
reason?: string; reason?: string;
} }
@ -1300,7 +1308,7 @@ declare interface WebSocketCloseInfo {
* @category WebSockets * @category WebSockets
* @experimental * @experimental
*/ */
declare interface WebSocketStream { interface WebSocketStream {
url: string; url: string;
opened: Promise<WebSocketConnection>; opened: Promise<WebSocketConnection>;
closed: Promise<WebSocketCloseInfo>; closed: Promise<WebSocketCloseInfo>;
@ -1324,7 +1332,7 @@ declare var WebSocketStream: {
* @category WebSockets * @category WebSockets
* @experimental * @experimental
*/ */
declare interface WebSocketError extends DOMException { interface WebSocketError extends DOMException {
readonly closeCode: number; readonly closeCode: number;
readonly reason: string; readonly reason: string;
} }
@ -2884,7 +2892,7 @@ declare namespace Temporal {
* @category Temporal * @category Temporal
* @experimental * @experimental
*/ */
declare interface Date { interface Date {
toTemporalInstant(): Temporal.Instant; toTemporalInstant(): Temporal.Instant;
} }
@ -2986,7 +2994,7 @@ declare namespace Intl {
* @category Platform * @category Platform
* @experimental * @experimental
*/ */
declare interface Float16Array { interface Float16Array {
/** /**
* The size in bytes of each element in the array. * The size in bytes of each element in the array.
*/ */
@ -3301,7 +3309,7 @@ declare interface Float16Array {
* @category Platform * @category Platform
* @experimental * @experimental
*/ */
declare interface Float16ArrayConstructor { interface Float16ArrayConstructor {
readonly prototype: Float16Array; readonly prototype: Float16Array;
new (length: number): Float16Array; new (length: number): Float16Array;
new (array: ArrayLike<number> | ArrayBufferLike): Float16Array; new (array: ArrayLike<number> | ArrayBufferLike): Float16Array;
@ -3350,7 +3358,7 @@ declare var Float16Array: Float16ArrayConstructor;
* @category Platform * @category Platform
* @experimental * @experimental
*/ */
declare interface Float16Array { interface Float16Array {
[Symbol.iterator](): IterableIterator<number>; [Symbol.iterator](): IterableIterator<number>;
/** /**
* Returns an array of key, value pairs for every entry in the array * Returns an array of key, value pairs for every entry in the array
@ -3370,7 +3378,7 @@ declare interface Float16Array {
* @category Platform * @category Platform
* @experimental * @experimental
*/ */
declare interface Float16Constructor { interface Float16Constructor {
new (elements: Iterable<number>): Float16Array; new (elements: Iterable<number>): Float16Array;
/** /**
@ -3390,7 +3398,7 @@ declare interface Float16Constructor {
* @category Platform * @category Platform
* @experimental * @experimental
*/ */
declare interface Float16Array { interface Float16Array {
readonly [Symbol.toStringTag]: "Float16Array"; readonly [Symbol.toStringTag]: "Float16Array";
} }
@ -3398,7 +3406,7 @@ declare interface Float16Array {
* @category Platform * @category Platform
* @experimental * @experimental
*/ */
declare interface Float16Array { interface Float16Array {
/** /**
* Determines whether an array includes a certain element, returning true or false as appropriate. * Determines whether an array includes a certain element, returning true or false as appropriate.
* @param searchElement The element to search for. * @param searchElement The element to search for.
@ -3411,7 +3419,7 @@ declare interface Float16Array {
* @category Platform * @category Platform
* @experimental * @experimental
*/ */
declare interface Float16ArrayConstructor { interface Float16ArrayConstructor {
new (): Float16Array; new (): Float16Array;
} }
@ -3419,7 +3427,7 @@ declare interface Float16ArrayConstructor {
* @category Platform * @category Platform
* @experimental * @experimental
*/ */
declare interface Float16Array { interface Float16Array {
/** /**
* Returns the item located at the specified index. * Returns the item located at the specified index.
* @param index The zero-based index of the desired code unit. A negative index will count back from the last item. * @param index The zero-based index of the desired code unit. A negative index will count back from the last item.
@ -3431,7 +3439,7 @@ declare interface Float16Array {
* @category Platform * @category Platform
* @experimental * @experimental
*/ */
declare interface Float16Array { interface Float16Array {
/** /**
* Returns the value of the last element in the array where predicate is true, and undefined * Returns the value of the last element in the array where predicate is true, and undefined
* otherwise. * otherwise.
@ -3507,7 +3515,7 @@ declare interface Float16Array {
* @category Platform * @category Platform
* @experimental * @experimental
*/ */
declare interface DataView { interface DataView {
/** /**
* Gets the Float16 value at the specified byte offset from the start of the view. There is * Gets the Float16 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. * no alignment constraint; multi-byte values may be fetched from any offset.

View file

@ -8,14 +8,14 @@
/// <reference lib="deno.cache" /> /// <reference lib="deno.cache" />
/** @category Platform */ /** @category Platform */
declare interface WindowEventMap { interface WindowEventMap {
"error": ErrorEvent; "error": ErrorEvent;
"unhandledrejection": PromiseRejectionEvent; "unhandledrejection": PromiseRejectionEvent;
"rejectionhandled": PromiseRejectionEvent; "rejectionhandled": PromiseRejectionEvent;
} }
/** @category Platform */ /** @category Platform */
declare interface Window extends EventTarget { interface Window extends EventTarget {
readonly window: Window & typeof globalThis; readonly window: Window & typeof globalThis;
readonly self: Window & typeof globalThis; readonly self: Window & typeof globalThis;
onerror: ((this: Window, ev: ErrorEvent) => any) | null; onerror: ((this: Window, ev: ErrorEvent) => any) | null;
@ -105,7 +105,7 @@ declare var sessionStorage: Storage;
declare var caches: CacheStorage; declare var caches: CacheStorage;
/** @category Platform */ /** @category Platform */
declare interface Navigator { interface Navigator {
readonly gpu: GPU; readonly gpu: GPU;
readonly hardwareConcurrency: number; readonly hardwareConcurrency: number;
readonly userAgent: string; readonly userAgent: string;
@ -221,7 +221,7 @@ declare function removeEventListener(
* *
* @category Platform * @category Platform
*/ */
declare interface Location { interface Location {
/** Returns a DOMStringList object listing the origins of the ancestor /** Returns a DOMStringList object listing the origins of the ancestor
* browsing contexts, from the parent browsing context to the top-level * browsing contexts, from the parent browsing context to the top-level
* browsing context. * browsing context.

View file

@ -6,12 +6,12 @@
/// <reference lib="esnext" /> /// <reference lib="esnext" />
/** @category GPU */ /** @category GPU */
declare interface GPUObjectBase { interface GPUObjectBase {
label: string; label: string;
} }
/** @category GPU */ /** @category GPU */
declare interface GPUObjectDescriptorBase { interface GPUObjectDescriptorBase {
label?: string; label?: string;
} }
@ -84,13 +84,13 @@ declare class GPU {
} }
/** @category GPU */ /** @category GPU */
declare interface GPURequestAdapterOptions { interface GPURequestAdapterOptions {
powerPreference?: GPUPowerPreference; powerPreference?: GPUPowerPreference;
forceFallbackAdapter?: boolean; forceFallbackAdapter?: boolean;
} }
/** @category GPU */ /** @category GPU */
declare type GPUPowerPreference = "low-power" | "high-performance"; type GPUPowerPreference = "low-power" | "high-performance";
/** @category GPU */ /** @category GPU */
declare class GPUAdapter { declare class GPUAdapter {
@ -103,13 +103,13 @@ declare class GPUAdapter {
} }
/** @category GPU */ /** @category GPU */
declare interface GPUDeviceDescriptor extends GPUObjectDescriptorBase { interface GPUDeviceDescriptor extends GPUObjectDescriptorBase {
requiredFeatures?: GPUFeatureName[]; requiredFeatures?: GPUFeatureName[];
requiredLimits?: Record<string, number>; requiredLimits?: Record<string, number>;
} }
/** @category GPU */ /** @category GPU */
declare type GPUFeatureName = type GPUFeatureName =
| "depth-clip-control" | "depth-clip-control"
| "depth32float-stencil8" | "depth32float-stencil8"
| "pipeline-statistics-query" | "pipeline-statistics-query"
@ -206,20 +206,20 @@ declare class GPUBuffer implements GPUObjectBase {
} }
/** @category GPU */ /** @category GPU */
declare type GPUBufferMapState = "unmapped" | "pending" | "mapped"; type GPUBufferMapState = "unmapped" | "pending" | "mapped";
/** @category GPU */ /** @category GPU */
declare interface GPUBufferDescriptor extends GPUObjectDescriptorBase { interface GPUBufferDescriptor extends GPUObjectDescriptorBase {
size: number; size: number;
usage: GPUBufferUsageFlags; usage: GPUBufferUsageFlags;
mappedAtCreation?: boolean; mappedAtCreation?: boolean;
} }
/** @category GPU */ /** @category GPU */
declare type GPUBufferUsageFlags = number; type GPUBufferUsageFlags = number;
/** @category GPU */ /** @category GPU */
declare type GPUFlagsConstant = number; type GPUFlagsConstant = number;
/** @category GPU */ /** @category GPU */
declare class GPUBufferUsage { declare class GPUBufferUsage {
@ -236,7 +236,7 @@ declare class GPUBufferUsage {
} }
/** @category GPU */ /** @category GPU */
declare type GPUMapModeFlags = number; type GPUMapModeFlags = number;
/** @category GPU */ /** @category GPU */
declare class GPUMapMode { declare class GPUMapMode {
@ -262,7 +262,7 @@ declare class GPUTexture implements GPUObjectBase {
} }
/** @category GPU */ /** @category GPU */
declare interface GPUTextureDescriptor extends GPUObjectDescriptorBase { interface GPUTextureDescriptor extends GPUObjectDescriptorBase {
size: GPUExtent3D; size: GPUExtent3D;
mipLevelCount?: number; mipLevelCount?: number;
sampleCount?: number; sampleCount?: number;
@ -273,10 +273,10 @@ declare interface GPUTextureDescriptor extends GPUObjectDescriptorBase {
} }
/** @category GPU */ /** @category GPU */
declare type GPUTextureDimension = "1d" | "2d" | "3d"; type GPUTextureDimension = "1d" | "2d" | "3d";
/** @category GPU */ /** @category GPU */
declare type GPUTextureUsageFlags = number; type GPUTextureUsageFlags = number;
/** @category GPU */ /** @category GPU */
declare class GPUTextureUsage { declare class GPUTextureUsage {
@ -293,7 +293,7 @@ declare class GPUTextureView implements GPUObjectBase {
} }
/** @category GPU */ /** @category GPU */
declare interface GPUTextureViewDescriptor extends GPUObjectDescriptorBase { interface GPUTextureViewDescriptor extends GPUObjectDescriptorBase {
format?: GPUTextureFormat; format?: GPUTextureFormat;
dimension?: GPUTextureViewDimension; dimension?: GPUTextureViewDimension;
aspect?: GPUTextureAspect; aspect?: GPUTextureAspect;
@ -304,7 +304,7 @@ declare interface GPUTextureViewDescriptor extends GPUObjectDescriptorBase {
} }
/** @category GPU */ /** @category GPU */
declare type GPUTextureViewDimension = type GPUTextureViewDimension =
| "1d" | "1d"
| "2d" | "2d"
| "2d-array" | "2d-array"
@ -313,10 +313,10 @@ declare type GPUTextureViewDimension =
| "3d"; | "3d";
/** @category GPU */ /** @category GPU */
declare type GPUTextureAspect = "all" | "stencil-only" | "depth-only"; type GPUTextureAspect = "all" | "stencil-only" | "depth-only";
/** @category GPU */ /** @category GPU */
declare type GPUTextureFormat = type GPUTextureFormat =
| "r8unorm" | "r8unorm"
| "r8snorm" | "r8snorm"
| "r8uint" | "r8uint"
@ -419,7 +419,7 @@ declare class GPUSampler implements GPUObjectBase {
} }
/** @category GPU */ /** @category GPU */
declare interface GPUSamplerDescriptor extends GPUObjectDescriptorBase { interface GPUSamplerDescriptor extends GPUObjectDescriptorBase {
addressModeU?: GPUAddressMode; addressModeU?: GPUAddressMode;
addressModeV?: GPUAddressMode; addressModeV?: GPUAddressMode;
addressModeW?: GPUAddressMode; addressModeW?: GPUAddressMode;
@ -433,16 +433,16 @@ declare interface GPUSamplerDescriptor extends GPUObjectDescriptorBase {
} }
/** @category GPU */ /** @category GPU */
declare type GPUAddressMode = "clamp-to-edge" | "repeat" | "mirror-repeat"; type GPUAddressMode = "clamp-to-edge" | "repeat" | "mirror-repeat";
/** @category GPU */ /** @category GPU */
declare type GPUFilterMode = "nearest" | "linear"; type GPUFilterMode = "nearest" | "linear";
/** @category GPU */ /** @category GPU */
declare type GPUMipmapFilterMode = "nearest" | "linear"; type GPUMipmapFilterMode = "nearest" | "linear";
/** @category GPU */ /** @category GPU */
declare type GPUCompareFunction = type GPUCompareFunction =
| "never" | "never"
| "less" | "less"
| "equal" | "equal"
@ -458,12 +458,12 @@ declare class GPUBindGroupLayout implements GPUObjectBase {
} }
/** @category GPU */ /** @category GPU */
declare interface GPUBindGroupLayoutDescriptor extends GPUObjectDescriptorBase { interface GPUBindGroupLayoutDescriptor extends GPUObjectDescriptorBase {
entries: GPUBindGroupLayoutEntry[]; entries: GPUBindGroupLayoutEntry[];
} }
/** @category GPU */ /** @category GPU */
declare interface GPUBindGroupLayoutEntry { interface GPUBindGroupLayoutEntry {
binding: number; binding: number;
visibility: GPUShaderStageFlags; visibility: GPUShaderStageFlags;
@ -474,7 +474,7 @@ declare interface GPUBindGroupLayoutEntry {
} }
/** @category GPU */ /** @category GPU */
declare type GPUShaderStageFlags = number; type GPUShaderStageFlags = number;
/** @category GPU */ /** @category GPU */
declare class GPUShaderStage { declare class GPUShaderStage {
@ -484,35 +484,35 @@ declare class GPUShaderStage {
} }
/** @category GPU */ /** @category GPU */
declare interface GPUBufferBindingLayout { interface GPUBufferBindingLayout {
type?: GPUBufferBindingType; type?: GPUBufferBindingType;
hasDynamicOffset?: boolean; hasDynamicOffset?: boolean;
minBindingSize?: number; minBindingSize?: number;
} }
/** @category GPU */ /** @category GPU */
declare type GPUBufferBindingType = "uniform" | "storage" | "read-only-storage"; type GPUBufferBindingType = "uniform" | "storage" | "read-only-storage";
/** @category GPU */ /** @category GPU */
declare interface GPUSamplerBindingLayout { interface GPUSamplerBindingLayout {
type?: GPUSamplerBindingType; type?: GPUSamplerBindingType;
} }
/** @category GPU */ /** @category GPU */
declare type GPUSamplerBindingType = type GPUSamplerBindingType =
| "filtering" | "filtering"
| "non-filtering" | "non-filtering"
| "comparison"; | "comparison";
/** @category GPU */ /** @category GPU */
declare interface GPUTextureBindingLayout { interface GPUTextureBindingLayout {
sampleType?: GPUTextureSampleType; sampleType?: GPUTextureSampleType;
viewDimension?: GPUTextureViewDimension; viewDimension?: GPUTextureViewDimension;
multisampled?: boolean; multisampled?: boolean;
} }
/** @category GPU */ /** @category GPU */
declare type GPUTextureSampleType = type GPUTextureSampleType =
| "float" | "float"
| "unfilterable-float" | "unfilterable-float"
| "depth" | "depth"
@ -520,13 +520,13 @@ declare type GPUTextureSampleType =
| "uint"; | "uint";
/** @category GPU */ /** @category GPU */
declare type GPUStorageTextureAccess = type GPUStorageTextureAccess =
| "write-only" | "write-only"
| "read-only" | "read-only"
| "read-write"; | "read-write";
/** @category GPU */ /** @category GPU */
declare interface GPUStorageTextureBindingLayout { interface GPUStorageTextureBindingLayout {
access: GPUStorageTextureAccess; access: GPUStorageTextureAccess;
format: GPUTextureFormat; format: GPUTextureFormat;
viewDimension?: GPUTextureViewDimension; viewDimension?: GPUTextureViewDimension;
@ -538,25 +538,25 @@ declare class GPUBindGroup implements GPUObjectBase {
} }
/** @category GPU */ /** @category GPU */
declare interface GPUBindGroupDescriptor extends GPUObjectDescriptorBase { interface GPUBindGroupDescriptor extends GPUObjectDescriptorBase {
layout: GPUBindGroupLayout; layout: GPUBindGroupLayout;
entries: GPUBindGroupEntry[]; entries: GPUBindGroupEntry[];
} }
/** @category GPU */ /** @category GPU */
declare type GPUBindingResource = type GPUBindingResource =
| GPUSampler | GPUSampler
| GPUTextureView | GPUTextureView
| GPUBufferBinding; | GPUBufferBinding;
/** @category GPU */ /** @category GPU */
declare interface GPUBindGroupEntry { interface GPUBindGroupEntry {
binding: number; binding: number;
resource: GPUBindingResource; resource: GPUBindingResource;
} }
/** @category GPU */ /** @category GPU */
declare interface GPUBufferBinding { interface GPUBufferBinding {
buffer: GPUBuffer; buffer: GPUBuffer;
offset?: number; offset?: number;
size?: number; size?: number;
@ -568,15 +568,15 @@ declare class GPUPipelineLayout implements GPUObjectBase {
} }
/** @category GPU */ /** @category GPU */
declare interface GPUPipelineLayoutDescriptor extends GPUObjectDescriptorBase { interface GPUPipelineLayoutDescriptor extends GPUObjectDescriptorBase {
bindGroupLayouts: GPUBindGroupLayout[]; bindGroupLayouts: GPUBindGroupLayout[];
} }
/** @category GPU */ /** @category GPU */
declare type GPUCompilationMessageType = "error" | "warning" | "info"; type GPUCompilationMessageType = "error" | "warning" | "info";
/** @category GPU */ /** @category GPU */
declare interface GPUCompilationMessage { interface GPUCompilationMessage {
readonly message: string; readonly message: string;
readonly type: GPUCompilationMessageType; readonly type: GPUCompilationMessageType;
readonly lineNum: number; readonly lineNum: number;
@ -584,7 +584,7 @@ declare interface GPUCompilationMessage {
} }
/** @category GPU */ /** @category GPU */
declare interface GPUCompilationInfo { interface GPUCompilationInfo {
readonly messages: ReadonlyArray<GPUCompilationMessage>; readonly messages: ReadonlyArray<GPUCompilationMessage>;
} }
@ -596,12 +596,12 @@ declare class GPUPipelineError extends DOMException {
} }
/** @category GPU */ /** @category GPU */
declare interface GPUPipelineErrorInit { interface GPUPipelineErrorInit {
reason: GPUPipelineErrorReason; reason: GPUPipelineErrorReason;
} }
/** @category GPU */ /** @category GPU */
declare type GPUPipelineErrorReason = "validation" | "internal"; type GPUPipelineErrorReason = "validation" | "internal";
/** @category GPU */ /** @category GPU */
declare class GPUShaderModule implements GPUObjectBase { declare class GPUShaderModule implements GPUObjectBase {
@ -609,26 +609,26 @@ declare class GPUShaderModule implements GPUObjectBase {
} }
/** @category GPU */ /** @category GPU */
declare interface GPUShaderModuleDescriptor extends GPUObjectDescriptorBase { interface GPUShaderModuleDescriptor extends GPUObjectDescriptorBase {
code: string; code: string;
sourceMap?: any; sourceMap?: any;
} }
/** @category GPU */ /** @category GPU */
declare type GPUAutoLayoutMode = "auto"; type GPUAutoLayoutMode = "auto";
/** @category GPU */ /** @category GPU */
declare interface GPUPipelineDescriptorBase extends GPUObjectDescriptorBase { interface GPUPipelineDescriptorBase extends GPUObjectDescriptorBase {
layout: GPUPipelineLayout | GPUAutoLayoutMode; layout: GPUPipelineLayout | GPUAutoLayoutMode;
} }
/** @category GPU */ /** @category GPU */
declare interface GPUPipelineBase { interface GPUPipelineBase {
getBindGroupLayout(index: number): GPUBindGroupLayout; getBindGroupLayout(index: number): GPUBindGroupLayout;
} }
/** @category GPU */ /** @category GPU */
declare interface GPUProgrammableStage { interface GPUProgrammableStage {
module: GPUShaderModule; module: GPUShaderModule;
entryPoint?: string; entryPoint?: string;
constants?: Record<string, number>; constants?: Record<string, number>;
@ -642,8 +642,7 @@ declare class GPUComputePipeline implements GPUObjectBase, GPUPipelineBase {
} }
/** @category GPU */ /** @category GPU */
declare interface GPUComputePipelineDescriptor interface GPUComputePipelineDescriptor extends GPUPipelineDescriptorBase {
extends GPUPipelineDescriptorBase {
compute: GPUProgrammableStage; compute: GPUProgrammableStage;
} }
@ -655,8 +654,7 @@ declare class GPURenderPipeline implements GPUObjectBase, GPUPipelineBase {
} }
/** @category GPU */ /** @category GPU */
declare interface GPURenderPipelineDescriptor interface GPURenderPipelineDescriptor extends GPUPipelineDescriptorBase {
extends GPUPipelineDescriptorBase {
vertex: GPUVertexState; vertex: GPUVertexState;
primitive?: GPUPrimitiveState; primitive?: GPUPrimitiveState;
depthStencil?: GPUDepthStencilState; depthStencil?: GPUDepthStencilState;
@ -665,7 +663,7 @@ declare interface GPURenderPipelineDescriptor
} }
/** @category GPU */ /** @category GPU */
declare interface GPUPrimitiveState { interface GPUPrimitiveState {
topology?: GPUPrimitiveTopology; topology?: GPUPrimitiveTopology;
stripIndexFormat?: GPUIndexFormat; stripIndexFormat?: GPUIndexFormat;
frontFace?: GPUFrontFace; frontFace?: GPUFrontFace;
@ -674,7 +672,7 @@ declare interface GPUPrimitiveState {
} }
/** @category GPU */ /** @category GPU */
declare type GPUPrimitiveTopology = type GPUPrimitiveTopology =
| "point-list" | "point-list"
| "line-list" | "line-list"
| "line-strip" | "line-strip"
@ -682,25 +680,25 @@ declare type GPUPrimitiveTopology =
| "triangle-strip"; | "triangle-strip";
/** @category GPU */ /** @category GPU */
declare type GPUFrontFace = "ccw" | "cw"; type GPUFrontFace = "ccw" | "cw";
/** @category GPU */ /** @category GPU */
declare type GPUCullMode = "none" | "front" | "back"; type GPUCullMode = "none" | "front" | "back";
/** @category GPU */ /** @category GPU */
declare interface GPUMultisampleState { interface GPUMultisampleState {
count?: number; count?: number;
mask?: number; mask?: number;
alphaToCoverageEnabled?: boolean; alphaToCoverageEnabled?: boolean;
} }
/** @category GPU */ /** @category GPU */
declare interface GPUFragmentState extends GPUProgrammableStage { interface GPUFragmentState extends GPUProgrammableStage {
targets: (GPUColorTargetState | null)[]; targets: (GPUColorTargetState | null)[];
} }
/** @category GPU */ /** @category GPU */
declare interface GPUColorTargetState { interface GPUColorTargetState {
format: GPUTextureFormat; format: GPUTextureFormat;
blend?: GPUBlendState; blend?: GPUBlendState;
@ -708,13 +706,13 @@ declare interface GPUColorTargetState {
} }
/** @category GPU */ /** @category GPU */
declare interface GPUBlendState { interface GPUBlendState {
color: GPUBlendComponent; color: GPUBlendComponent;
alpha: GPUBlendComponent; alpha: GPUBlendComponent;
} }
/** @category GPU */ /** @category GPU */
declare type GPUColorWriteFlags = number; type GPUColorWriteFlags = number;
/** @category GPU */ /** @category GPU */
declare class GPUColorWrite { declare class GPUColorWrite {
@ -726,14 +724,14 @@ declare class GPUColorWrite {
} }
/** @category GPU */ /** @category GPU */
declare interface GPUBlendComponent { interface GPUBlendComponent {
operation?: GPUBlendOperation; operation?: GPUBlendOperation;
srcFactor?: GPUBlendFactor; srcFactor?: GPUBlendFactor;
dstFactor?: GPUBlendFactor; dstFactor?: GPUBlendFactor;
} }
/** @category GPU */ /** @category GPU */
declare type GPUBlendFactor = type GPUBlendFactor =
| "zero" | "zero"
| "one" | "one"
| "src" | "src"
@ -749,7 +747,7 @@ declare type GPUBlendFactor =
| "one-minus-constant"; | "one-minus-constant";
/** @category GPU */ /** @category GPU */
declare type GPUBlendOperation = type GPUBlendOperation =
| "add" | "add"
| "subtract" | "subtract"
| "reverse-subtract" | "reverse-subtract"
@ -757,7 +755,7 @@ declare type GPUBlendOperation =
| "max"; | "max";
/** @category GPU */ /** @category GPU */
declare interface GPUDepthStencilState { interface GPUDepthStencilState {
format: GPUTextureFormat; format: GPUTextureFormat;
depthWriteEnabled: boolean; depthWriteEnabled: boolean;
@ -775,7 +773,7 @@ declare interface GPUDepthStencilState {
} }
/** @category GPU */ /** @category GPU */
declare interface GPUStencilFaceState { interface GPUStencilFaceState {
compare?: GPUCompareFunction; compare?: GPUCompareFunction;
failOp?: GPUStencilOperation; failOp?: GPUStencilOperation;
depthFailOp?: GPUStencilOperation; depthFailOp?: GPUStencilOperation;
@ -783,7 +781,7 @@ declare interface GPUStencilFaceState {
} }
/** @category GPU */ /** @category GPU */
declare type GPUStencilOperation = type GPUStencilOperation =
| "keep" | "keep"
| "zero" | "zero"
| "replace" | "replace"
@ -794,10 +792,10 @@ declare type GPUStencilOperation =
| "decrement-wrap"; | "decrement-wrap";
/** @category GPU */ /** @category GPU */
declare type GPUIndexFormat = "uint16" | "uint32"; type GPUIndexFormat = "uint16" | "uint32";
/** @category GPU */ /** @category GPU */
declare type GPUVertexFormat = type GPUVertexFormat =
| "uint8x2" | "uint8x2"
| "uint8x4" | "uint8x4"
| "sint8x2" | "sint8x2"
@ -831,22 +829,22 @@ declare type GPUVertexFormat =
| "unorm10-10-10-2"; | "unorm10-10-10-2";
/** @category GPU */ /** @category GPU */
declare type GPUVertexStepMode = "vertex" | "instance"; type GPUVertexStepMode = "vertex" | "instance";
/** @category GPU */ /** @category GPU */
declare interface GPUVertexState extends GPUProgrammableStage { interface GPUVertexState extends GPUProgrammableStage {
buffers?: (GPUVertexBufferLayout | null)[]; buffers?: (GPUVertexBufferLayout | null)[];
} }
/** @category GPU */ /** @category GPU */
declare interface GPUVertexBufferLayout { interface GPUVertexBufferLayout {
arrayStride: number; arrayStride: number;
stepMode?: GPUVertexStepMode; stepMode?: GPUVertexStepMode;
attributes: GPUVertexAttribute[]; attributes: GPUVertexAttribute[];
} }
/** @category GPU */ /** @category GPU */
declare interface GPUVertexAttribute { interface GPUVertexAttribute {
format: GPUVertexFormat; format: GPUVertexFormat;
offset: number; offset: number;
@ -854,7 +852,7 @@ declare interface GPUVertexAttribute {
} }
/** @category GPU */ /** @category GPU */
declare interface GPUImageDataLayout { interface GPUImageDataLayout {
offset?: number; offset?: number;
bytesPerRow?: number; bytesPerRow?: number;
rowsPerImage?: number; rowsPerImage?: number;
@ -866,7 +864,7 @@ declare class GPUCommandBuffer implements GPUObjectBase {
} }
/** @category GPU */ /** @category GPU */
declare interface GPUCommandBufferDescriptor extends GPUObjectDescriptorBase {} interface GPUCommandBufferDescriptor extends GPUObjectDescriptorBase {}
/** @category GPU */ /** @category GPU */
declare class GPUCommandEncoder implements GPUObjectBase { declare class GPUCommandEncoder implements GPUObjectBase {
@ -927,15 +925,15 @@ declare class GPUCommandEncoder implements GPUObjectBase {
} }
/** @category GPU */ /** @category GPU */
declare interface GPUCommandEncoderDescriptor extends GPUObjectDescriptorBase {} interface GPUCommandEncoderDescriptor extends GPUObjectDescriptorBase {}
/** @category GPU */ /** @category GPU */
declare interface GPUImageCopyBuffer extends GPUImageDataLayout { interface GPUImageCopyBuffer extends GPUImageDataLayout {
buffer: GPUBuffer; buffer: GPUBuffer;
} }
/** @category GPU */ /** @category GPU */
declare interface GPUImageCopyTexture { interface GPUImageCopyTexture {
texture: GPUTexture; texture: GPUTexture;
mipLevel?: number; mipLevel?: number;
origin?: GPUOrigin3D; origin?: GPUOrigin3D;
@ -943,7 +941,7 @@ declare interface GPUImageCopyTexture {
} }
/** @category GPU */ /** @category GPU */
declare interface GPUProgrammablePassEncoder { interface GPUProgrammablePassEncoder {
setBindGroup( setBindGroup(
index: number, index: number,
bindGroup: GPUBindGroup, bindGroup: GPUBindGroup,
@ -993,19 +991,19 @@ declare class GPUComputePassEncoder
} }
/** @category GPU */ /** @category GPU */
declare interface GPUComputePassTimestampWrites { interface GPUComputePassTimestampWrites {
querySet: GPUQuerySet; querySet: GPUQuerySet;
beginningOfPassWriteIndex?: number; beginningOfPassWriteIndex?: number;
endOfPassWriteIndex?: number; endOfPassWriteIndex?: number;
} }
/** @category GPU */ /** @category GPU */
declare interface GPUComputePassDescriptor extends GPUObjectDescriptorBase { interface GPUComputePassDescriptor extends GPUObjectDescriptorBase {
timestampWrites?: GPUComputePassTimestampWrites; timestampWrites?: GPUComputePassTimestampWrites;
} }
/** @category GPU */ /** @category GPU */
declare interface GPURenderEncoderBase { interface GPURenderEncoderBase {
setPipeline(pipeline: GPURenderPipeline): undefined; setPipeline(pipeline: GPURenderPipeline): undefined;
setIndexBuffer( setIndexBuffer(
@ -1120,14 +1118,14 @@ declare class GPURenderPassEncoder
} }
/** @category GPU */ /** @category GPU */
declare interface GPURenderPassTimestampWrites { interface GPURenderPassTimestampWrites {
querySet: GPUQuerySet; querySet: GPUQuerySet;
beginningOfPassWriteIndex?: number; beginningOfPassWriteIndex?: number;
endOfPassWriteIndex?: number; endOfPassWriteIndex?: number;
} }
/** @category GPU */ /** @category GPU */
declare interface GPURenderPassDescriptor extends GPUObjectDescriptorBase { interface GPURenderPassDescriptor extends GPUObjectDescriptorBase {
colorAttachments: (GPURenderPassColorAttachment | null)[]; colorAttachments: (GPURenderPassColorAttachment | null)[];
depthStencilAttachment?: GPURenderPassDepthStencilAttachment; depthStencilAttachment?: GPURenderPassDepthStencilAttachment;
occlusionQuerySet?: GPUQuerySet; occlusionQuerySet?: GPUQuerySet;
@ -1135,7 +1133,7 @@ declare interface GPURenderPassDescriptor extends GPUObjectDescriptorBase {
} }
/** @category GPU */ /** @category GPU */
declare interface GPURenderPassColorAttachment { interface GPURenderPassColorAttachment {
view: GPUTextureView; view: GPUTextureView;
resolveTarget?: GPUTextureView; resolveTarget?: GPUTextureView;
@ -1145,7 +1143,7 @@ declare interface GPURenderPassColorAttachment {
} }
/** @category GPU */ /** @category GPU */
declare interface GPURenderPassDepthStencilAttachment { interface GPURenderPassDepthStencilAttachment {
view: GPUTextureView; view: GPUTextureView;
depthClearValue?: number; depthClearValue?: number;
@ -1160,10 +1158,10 @@ declare interface GPURenderPassDepthStencilAttachment {
} }
/** @category GPU */ /** @category GPU */
declare type GPULoadOp = "load" | "clear"; type GPULoadOp = "load" | "clear";
/** @category GPU */ /** @category GPU */
declare type GPUStoreOp = "store" | "discard"; type GPUStoreOp = "store" | "discard";
/** @category GPU */ /** @category GPU */
declare class GPURenderBundle implements GPUObjectBase { declare class GPURenderBundle implements GPUObjectBase {
@ -1171,7 +1169,7 @@ declare class GPURenderBundle implements GPUObjectBase {
} }
/** @category GPU */ /** @category GPU */
declare interface GPURenderBundleDescriptor extends GPUObjectDescriptorBase {} interface GPURenderBundleDescriptor extends GPUObjectDescriptorBase {}
/** @category GPU */ /** @category GPU */
declare class GPURenderBundleEncoder declare class GPURenderBundleEncoder
@ -1228,14 +1226,14 @@ declare class GPURenderBundleEncoder
} }
/** @category GPU */ /** @category GPU */
declare interface GPURenderPassLayout extends GPUObjectDescriptorBase { interface GPURenderPassLayout extends GPUObjectDescriptorBase {
colorFormats: (GPUTextureFormat | null)[]; colorFormats: (GPUTextureFormat | null)[];
depthStencilFormat?: GPUTextureFormat; depthStencilFormat?: GPUTextureFormat;
sampleCount?: number; sampleCount?: number;
} }
/** @category GPU */ /** @category GPU */
declare interface GPURenderBundleEncoderDescriptor extends GPURenderPassLayout { interface GPURenderBundleEncoderDescriptor extends GPURenderPassLayout {
depthReadOnly?: boolean; depthReadOnly?: boolean;
stencilReadOnly?: boolean; stencilReadOnly?: boolean;
} }
@ -1275,19 +1273,19 @@ declare class GPUQuerySet implements GPUObjectBase {
} }
/** @category GPU */ /** @category GPU */
declare interface GPUQuerySetDescriptor extends GPUObjectDescriptorBase { interface GPUQuerySetDescriptor extends GPUObjectDescriptorBase {
type: GPUQueryType; type: GPUQueryType;
count: number; count: number;
} }
/** @category GPU */ /** @category GPU */
declare type GPUQueryType = "occlusion" | "timestamp"; type GPUQueryType = "occlusion" | "timestamp";
/** @category GPU */ /** @category GPU */
declare type GPUDeviceLostReason = "destroyed"; type GPUDeviceLostReason = "destroyed";
/** @category GPU */ /** @category GPU */
declare interface GPUDeviceLostInfo { interface GPUDeviceLostInfo {
readonly reason: GPUDeviceLostReason; readonly reason: GPUDeviceLostReason;
readonly message: string; readonly message: string;
} }
@ -1313,7 +1311,7 @@ declare class GPUInternalError extends GPUError {
} }
/** @category GPU */ /** @category GPU */
declare type GPUErrorFilter = "out-of-memory" | "validation" | "internal"; type GPUErrorFilter = "out-of-memory" | "validation" | "internal";
/** @category GPU */ /** @category GPU */
declare class GPUUncapturedErrorEvent extends Event { declare class GPUUncapturedErrorEvent extends Event {
@ -1326,12 +1324,12 @@ declare class GPUUncapturedErrorEvent extends Event {
} }
/** @category GPU */ /** @category GPU */
declare interface GPUUncapturedErrorEventInit extends EventInit { interface GPUUncapturedErrorEventInit extends EventInit {
error: GPUError; error: GPUError;
} }
/** @category GPU */ /** @category GPU */
declare interface GPUColorDict { interface GPUColorDict {
r: number; r: number;
g: number; g: number;
b: number; b: number;
@ -1339,33 +1337,33 @@ declare interface GPUColorDict {
} }
/** @category GPU */ /** @category GPU */
declare type GPUColor = number[] | GPUColorDict; type GPUColor = number[] | GPUColorDict;
/** @category GPU */ /** @category GPU */
declare interface GPUOrigin3DDict { interface GPUOrigin3DDict {
x?: number; x?: number;
y?: number; y?: number;
z?: number; z?: number;
} }
/** @category GPU */ /** @category GPU */
declare type GPUOrigin3D = number[] | GPUOrigin3DDict; type GPUOrigin3D = number[] | GPUOrigin3DDict;
/** @category GPU */ /** @category GPU */
declare interface GPUExtent3DDict { interface GPUExtent3DDict {
width: number; width: number;
height?: number; height?: number;
depthOrArrayLayers?: number; depthOrArrayLayers?: number;
} }
/** @category GPU */ /** @category GPU */
declare type GPUExtent3D = number[] | GPUExtent3DDict; type GPUExtent3D = number[] | GPUExtent3DDict;
/** @category GPU */ /** @category GPU */
declare type GPUCanvasAlphaMode = "opaque" | "premultiplied"; type GPUCanvasAlphaMode = "opaque" | "premultiplied";
/** @category GPU */ /** @category GPU */
declare interface GPUCanvasConfiguration { interface GPUCanvasConfiguration {
device: GPUDevice; device: GPUDevice;
format: GPUTextureFormat; format: GPUTextureFormat;
usage?: GPUTextureUsageFlags; usage?: GPUTextureUsageFlags;
@ -1374,7 +1372,7 @@ declare interface GPUCanvasConfiguration {
alphaMode?: GPUCanvasAlphaMode; alphaMode?: GPUCanvasAlphaMode;
} }
/** @category GPU */ /** @category GPU */
declare interface GPUCanvasContext { interface GPUCanvasContext {
configure(configuration: GPUCanvasConfiguration): undefined; configure(configuration: GPUCanvasConfiguration): undefined;
unconfigure(): undefined; unconfigure(): undefined;
getCurrentTexture(): GPUTexture; getCurrentTexture(): GPUTexture;

View file

@ -9,7 +9,7 @@
* @category Messaging * @category Messaging
* @experimental * @experimental
*/ */
declare interface BroadcastChannelEventMap { interface BroadcastChannelEventMap {
"message": MessageEvent; "message": MessageEvent;
"messageerror": MessageEvent; "messageerror": MessageEvent;
} }
@ -18,7 +18,7 @@ declare interface BroadcastChannelEventMap {
* @category Messaging * @category Messaging
* @experimental * @experimental
*/ */
declare interface BroadcastChannel extends EventTarget { interface BroadcastChannel extends EventTarget {
/** /**
* Returns the channel name (as passed to the constructor). * Returns the channel name (as passed to the constructor).
*/ */

View file

@ -9,7 +9,7 @@
declare var caches: CacheStorage; declare var caches: CacheStorage;
/** @category Cache */ /** @category Cache */
declare interface CacheStorage { interface CacheStorage {
/** Open a cache storage for the provided name. */ /** Open a cache storage for the provided name. */
open(cacheName: string): Promise<Cache>; open(cacheName: string): Promise<Cache>;
/** Check if cache already exists for the provided name. */ /** Check if cache already exists for the provided name. */
@ -19,7 +19,7 @@ declare interface CacheStorage {
} }
/** @category Cache */ /** @category Cache */
declare interface Cache { interface Cache {
/** /**
* Put the provided request/response into the cache. * Put the provided request/response into the cache.
* *
@ -65,7 +65,7 @@ declare var CacheStorage: {
}; };
/** @category Cache */ /** @category Cache */
declare interface CacheQueryOptions { interface CacheQueryOptions {
ignoreMethod?: boolean; ignoreMethod?: boolean;
ignoreSearch?: boolean; ignoreSearch?: boolean;
ignoreVary?: boolean; ignoreVary?: boolean;

View file

@ -12,14 +12,14 @@
* *
* @category Canvas * @category Canvas
*/ */
declare type ColorSpaceConversion = "default" | "none"; type ColorSpaceConversion = "default" | "none";
/** /**
* Specifies how the bitmap image should be oriented. * Specifies how the bitmap image should be oriented.
* *
* @category Canvas * @category Canvas
*/ */
declare type ImageOrientation = "flipY" | "from-image" | "none"; type ImageOrientation = "flipY" | "from-image" | "none";
/** /**
* Specifies whether the bitmap's color channels should be premultiplied by * Specifies whether the bitmap's color channels should be premultiplied by
@ -27,7 +27,7 @@ declare type ImageOrientation = "flipY" | "from-image" | "none";
* *
* @category Canvas * @category Canvas
*/ */
declare type PremultiplyAlpha = "default" | "none" | "premultiply"; type PremultiplyAlpha = "default" | "none" | "premultiply";
/** /**
* Specifies the algorithm to be used for resizing the input to match the * Specifies the algorithm to be used for resizing the input to match the
@ -35,20 +35,20 @@ declare type PremultiplyAlpha = "default" | "none" | "premultiply";
* *
* @category Canvas * @category Canvas
*/ */
declare type ResizeQuality = "high" | "low" | "medium" | "pixelated"; type ResizeQuality = "high" | "low" | "medium" | "pixelated";
/** /**
* The `ImageBitmapSource` type represents an image data source that can be * The `ImageBitmapSource` type represents an image data source that can be
* used to create an `ImageBitmap`. * used to create an `ImageBitmap`.
* *
* @category Canvas */ * @category Canvas */
declare type ImageBitmapSource = Blob | ImageData; type ImageBitmapSource = Blob | ImageData;
/** /**
* The options of {@linkcode createImageBitmap}. * The options of {@linkcode createImageBitmap}.
* *
* @category Canvas */ * @category Canvas */
declare interface ImageBitmapOptions { interface ImageBitmapOptions {
/** /**
* Specifies whether the image should be decoded using color space * Specifies whether the image should be decoded using color space
* conversion. Either none or default (default). The value default * conversion. Either none or default (default). The value default
@ -116,7 +116,7 @@ declare function createImageBitmap(
* *
* @category Canvas * @category Canvas
*/ */
declare interface ImageBitmap { interface ImageBitmap {
/** /**
* The height of the bitmap. * The height of the bitmap.
*/ */

View file

@ -6,7 +6,7 @@
/// <reference lib="esnext" /> /// <reference lib="esnext" />
/** @category I/O */ /** @category I/O */
declare interface Console { interface Console {
assert(condition?: boolean, ...data: any[]): void; assert(condition?: boolean, ...data: any[]): void;
clear(): void; clear(): void;
count(label?: string): void; count(label?: string): void;

View file

@ -9,23 +9,23 @@
declare var crypto: Crypto; declare var crypto: Crypto;
/** @category Crypto */ /** @category Crypto */
declare interface Algorithm { interface Algorithm {
name: string; name: string;
} }
/** @category Crypto */ /** @category Crypto */
declare interface KeyAlgorithm { interface KeyAlgorithm {
name: string; name: string;
} }
/** @category Crypto */ /** @category Crypto */
declare type AlgorithmIdentifier = string | Algorithm; type AlgorithmIdentifier = string | Algorithm;
/** @category Crypto */ /** @category Crypto */
declare type HashAlgorithmIdentifier = AlgorithmIdentifier; type HashAlgorithmIdentifier = AlgorithmIdentifier;
/** @category Crypto */ /** @category Crypto */
declare type KeyType = "private" | "public" | "secret"; type KeyType = "private" | "public" | "secret";
/** @category Crypto */ /** @category Crypto */
declare type KeyUsage = type KeyUsage =
| "decrypt" | "decrypt"
| "deriveBits" | "deriveBits"
| "deriveKey" | "deriveKey"
@ -35,19 +35,19 @@ declare type KeyUsage =
| "verify" | "verify"
| "wrapKey"; | "wrapKey";
/** @category Crypto */ /** @category Crypto */
declare type KeyFormat = "jwk" | "pkcs8" | "raw" | "spki"; type KeyFormat = "jwk" | "pkcs8" | "raw" | "spki";
/** @category Crypto */ /** @category Crypto */
declare type NamedCurve = string; type NamedCurve = string;
/** @category Crypto */ /** @category Crypto */
declare interface RsaOtherPrimesInfo { interface RsaOtherPrimesInfo {
d?: string; d?: string;
r?: string; r?: string;
t?: string; t?: string;
} }
/** @category Crypto */ /** @category Crypto */
declare interface JsonWebKey { interface JsonWebKey {
alg?: string; alg?: string;
crv?: string; crv?: string;
d?: string; d?: string;
@ -56,6 +56,7 @@ declare interface JsonWebKey {
e?: string; e?: string;
ext?: boolean; ext?: boolean;
k?: string; k?: string;
// deno-lint-ignore camelcase
key_ops?: string[]; key_ops?: string[];
kty?: string; kty?: string;
n?: string; n?: string;
@ -69,129 +70,129 @@ declare interface JsonWebKey {
} }
/** @category Crypto */ /** @category Crypto */
declare interface AesCbcParams extends Algorithm { interface AesCbcParams extends Algorithm {
iv: BufferSource; iv: BufferSource;
} }
/** @category Crypto */ /** @category Crypto */
declare interface AesGcmParams extends Algorithm { interface AesGcmParams extends Algorithm {
iv: BufferSource; iv: BufferSource;
additionalData?: BufferSource; additionalData?: BufferSource;
tagLength?: number; tagLength?: number;
} }
/** @category Crypto */ /** @category Crypto */
declare interface AesCtrParams extends Algorithm { interface AesCtrParams extends Algorithm {
counter: BufferSource; counter: BufferSource;
length: number; length: number;
} }
/** @category Crypto */ /** @category Crypto */
declare interface HmacKeyGenParams extends Algorithm { interface HmacKeyGenParams extends Algorithm {
hash: HashAlgorithmIdentifier; hash: HashAlgorithmIdentifier;
length?: number; length?: number;
} }
/** @category Crypto */ /** @category Crypto */
declare interface EcKeyGenParams extends Algorithm { interface EcKeyGenParams extends Algorithm {
namedCurve: NamedCurve; namedCurve: NamedCurve;
} }
/** @category Crypto */ /** @category Crypto */
declare interface EcKeyImportParams extends Algorithm { interface EcKeyImportParams extends Algorithm {
namedCurve: NamedCurve; namedCurve: NamedCurve;
} }
/** @category Crypto */ /** @category Crypto */
declare interface EcdsaParams extends Algorithm { interface EcdsaParams extends Algorithm {
hash: HashAlgorithmIdentifier; hash: HashAlgorithmIdentifier;
} }
/** @category Crypto */ /** @category Crypto */
declare interface RsaHashedImportParams extends Algorithm { interface RsaHashedImportParams extends Algorithm {
hash: HashAlgorithmIdentifier; hash: HashAlgorithmIdentifier;
} }
/** @category Crypto */ /** @category Crypto */
declare interface RsaHashedKeyGenParams extends RsaKeyGenParams { interface RsaHashedKeyGenParams extends RsaKeyGenParams {
hash: HashAlgorithmIdentifier; hash: HashAlgorithmIdentifier;
} }
/** @category Crypto */ /** @category Crypto */
declare interface RsaKeyGenParams extends Algorithm { interface RsaKeyGenParams extends Algorithm {
modulusLength: number; modulusLength: number;
publicExponent: Uint8Array; publicExponent: Uint8Array;
} }
/** @category Crypto */ /** @category Crypto */
declare interface RsaPssParams extends Algorithm { interface RsaPssParams extends Algorithm {
saltLength: number; saltLength: number;
} }
/** @category Crypto */ /** @category Crypto */
declare interface RsaOaepParams extends Algorithm { interface RsaOaepParams extends Algorithm {
label?: Uint8Array; label?: Uint8Array;
} }
/** @category Crypto */ /** @category Crypto */
declare interface HmacImportParams extends Algorithm { interface HmacImportParams extends Algorithm {
hash: HashAlgorithmIdentifier; hash: HashAlgorithmIdentifier;
length?: number; length?: number;
} }
/** @category Crypto */ /** @category Crypto */
declare interface EcKeyAlgorithm extends KeyAlgorithm { interface EcKeyAlgorithm extends KeyAlgorithm {
namedCurve: NamedCurve; namedCurve: NamedCurve;
} }
/** @category Crypto */ /** @category Crypto */
declare interface HmacKeyAlgorithm extends KeyAlgorithm { interface HmacKeyAlgorithm extends KeyAlgorithm {
hash: KeyAlgorithm; hash: KeyAlgorithm;
length: number; length: number;
} }
/** @category Crypto */ /** @category Crypto */
declare interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm { interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm {
hash: KeyAlgorithm; hash: KeyAlgorithm;
} }
/** @category Crypto */ /** @category Crypto */
declare interface RsaKeyAlgorithm extends KeyAlgorithm { interface RsaKeyAlgorithm extends KeyAlgorithm {
modulusLength: number; modulusLength: number;
publicExponent: Uint8Array; publicExponent: Uint8Array;
} }
/** @category Crypto */ /** @category Crypto */
declare interface HkdfParams extends Algorithm { interface HkdfParams extends Algorithm {
hash: HashAlgorithmIdentifier; hash: HashAlgorithmIdentifier;
info: BufferSource; info: BufferSource;
salt: BufferSource; salt: BufferSource;
} }
/** @category Crypto */ /** @category Crypto */
declare interface Pbkdf2Params extends Algorithm { interface Pbkdf2Params extends Algorithm {
hash: HashAlgorithmIdentifier; hash: HashAlgorithmIdentifier;
iterations: number; iterations: number;
salt: BufferSource; salt: BufferSource;
} }
/** @category Crypto */ /** @category Crypto */
declare interface AesDerivedKeyParams extends Algorithm { interface AesDerivedKeyParams extends Algorithm {
length: number; length: number;
} }
/** @category Crypto */ /** @category Crypto */
declare interface EcdhKeyDeriveParams extends Algorithm { interface EcdhKeyDeriveParams extends Algorithm {
public: CryptoKey; public: CryptoKey;
} }
/** @category Crypto */ /** @category Crypto */
declare interface AesKeyGenParams extends Algorithm { interface AesKeyGenParams extends Algorithm {
length: number; length: number;
} }
/** @category Crypto */ /** @category Crypto */
declare interface AesKeyAlgorithm extends KeyAlgorithm { interface AesKeyAlgorithm extends KeyAlgorithm {
length: number; length: number;
} }
@ -200,7 +201,7 @@ declare interface AesKeyAlgorithm extends KeyAlgorithm {
* *
* @category Crypto * @category Crypto
*/ */
declare interface CryptoKey { interface CryptoKey {
readonly algorithm: KeyAlgorithm; readonly algorithm: KeyAlgorithm;
readonly extractable: boolean; readonly extractable: boolean;
readonly type: KeyType; readonly type: KeyType;
@ -218,7 +219,7 @@ declare var CryptoKey: {
* *
* @category Crypto * @category Crypto
*/ */
declare interface CryptoKeyPair { interface CryptoKeyPair {
privateKey: CryptoKey; privateKey: CryptoKey;
publicKey: CryptoKey; publicKey: CryptoKey;
} }
@ -235,7 +236,7 @@ declare var CryptoKeyPair: {
* *
* @category Crypto * @category Crypto
*/ */
declare interface SubtleCrypto { interface SubtleCrypto {
generateKey( generateKey(
algorithm: RsaHashedKeyGenParams | EcKeyGenParams, algorithm: RsaHashedKeyGenParams | EcKeyGenParams,
extractable: boolean, extractable: boolean,
@ -374,7 +375,7 @@ declare var SubtleCrypto: {
}; };
/** @category Crypto */ /** @category Crypto */
declare interface Crypto { interface Crypto {
readonly subtle: SubtleCrypto; readonly subtle: SubtleCrypto;
getRandomValues< getRandomValues<
T extends T extends

View file

@ -6,7 +6,7 @@
/// <reference lib="esnext" /> /// <reference lib="esnext" />
/** @category Platform */ /** @category Platform */
declare interface DomIterable<K, V> { interface DomIterable<K, V> {
keys(): IterableIterator<K>; keys(): IterableIterator<K>;
values(): IterableIterator<V>; values(): IterableIterator<V>;
entries(): IterableIterator<[K, V]>; entries(): IterableIterator<[K, V]>;
@ -18,7 +18,7 @@ declare interface DomIterable<K, V> {
} }
/** @category Fetch */ /** @category Fetch */
declare type FormDataEntryValue = File | string; type FormDataEntryValue = File | string;
/** Provides a way to easily construct a set of key/value pairs representing /** Provides a way to easily construct a set of key/value pairs representing
* 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
@ -27,7 +27,7 @@ declare type FormDataEntryValue = File | string;
* *
* @category Fetch * @category Fetch
*/ */
declare interface FormData extends 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;
@ -43,7 +43,7 @@ declare var FormData: {
}; };
/** @category Fetch */ /** @category Fetch */
declare interface Body { interface Body {
/** A simple getter used to expose a `ReadableStream` of the body contents. */ /** A simple getter used to expose a `ReadableStream` of the body contents. */
readonly body: ReadableStream<Uint8Array> | null; readonly body: ReadableStream<Uint8Array> | null;
/** Stores a `Boolean` that declares whether the body has been used in a /** Stores a `Boolean` that declares whether the body has been used in a
@ -77,7 +77,7 @@ declare interface Body {
} }
/** @category Fetch */ /** @category Fetch */
declare type HeadersInit = Iterable<string[]> | Record<string, string>; type HeadersInit = Iterable<string[]> | Record<string, string>;
/** This Fetch API interface allows you to perform various actions on HTTP /** This Fetch API interface allows you to perform various actions on HTTP
* request and response headers. These actions include retrieving, setting, * request and response headers. These actions include retrieving, setting,
@ -89,7 +89,7 @@ declare type HeadersInit = Iterable<string[]> | Record<string, string>;
* *
* @category Fetch * @category Fetch
*/ */
declare interface Headers extends 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.
*/ */
@ -130,9 +130,9 @@ declare var Headers: {
}; };
/** @category Fetch */ /** @category Fetch */
declare type RequestInfo = Request | string; type RequestInfo = Request | string;
/** @category Fetch */ /** @category Fetch */
declare type RequestCache = type RequestCache =
| "default" | "default"
| "force-cache" | "force-cache"
| "no-cache" | "no-cache"
@ -140,13 +140,13 @@ declare type RequestCache =
| "only-if-cached" | "only-if-cached"
| "reload"; | "reload";
/** @category Fetch */ /** @category Fetch */
declare type RequestCredentials = "include" | "omit" | "same-origin"; type RequestCredentials = "include" | "omit" | "same-origin";
/** @category Fetch */ /** @category Fetch */
declare type RequestMode = "cors" | "navigate" | "no-cors" | "same-origin"; type RequestMode = "cors" | "navigate" | "no-cors" | "same-origin";
/** @category Fetch */ /** @category Fetch */
declare type RequestRedirect = "error" | "follow" | "manual"; type RequestRedirect = "error" | "follow" | "manual";
/** @category Fetch */ /** @category Fetch */
declare type ReferrerPolicy = type ReferrerPolicy =
| "" | ""
| "no-referrer" | "no-referrer"
| "no-referrer-when-downgrade" | "no-referrer-when-downgrade"
@ -157,7 +157,7 @@ declare type ReferrerPolicy =
| "strict-origin-when-cross-origin" | "strict-origin-when-cross-origin"
| "unsafe-url"; | "unsafe-url";
/** @category Fetch */ /** @category Fetch */
declare type BodyInit = type BodyInit =
| Blob | Blob
| BufferSource | BufferSource
| FormData | FormData
@ -165,7 +165,7 @@ declare type BodyInit =
| ReadableStream<Uint8Array> | ReadableStream<Uint8Array>
| string; | string;
/** @category Fetch */ /** @category Fetch */
declare type RequestDestination = type RequestDestination =
| "" | ""
| "audio" | "audio"
| "audioworklet" | "audioworklet"
@ -186,7 +186,7 @@ declare type RequestDestination =
| "xslt"; | "xslt";
/** @category Fetch */ /** @category Fetch */
declare interface RequestInit { interface RequestInit {
/** /**
* A BodyInit object or null to set request's body. * A BodyInit object or null to set request's body.
*/ */
@ -254,7 +254,7 @@ declare interface RequestInit {
* *
* @category Fetch * @category Fetch
*/ */
declare interface Request extends Body { interface Request extends Body {
/** /**
* Returns the cache mode associated with request, which is a string * Returns the cache mode associated with request, which is a string
* indicating how the request will interact with the browser's cache when * indicating how the request will interact with the browser's cache when
@ -350,14 +350,14 @@ declare var Request: {
}; };
/** @category Fetch */ /** @category Fetch */
declare interface ResponseInit { interface ResponseInit {
headers?: HeadersInit; headers?: HeadersInit;
status?: number; status?: number;
statusText?: string; statusText?: string;
} }
/** @category Fetch */ /** @category Fetch */
declare type ResponseType = type ResponseType =
| "basic" | "basic"
| "cors" | "cors"
| "default" | "default"
@ -369,7 +369,7 @@ declare type ResponseType =
* *
* @category Fetch * @category Fetch
*/ */
declare interface Response extends Body { interface Response extends Body {
readonly headers: Headers; readonly headers: Headers;
readonly ok: boolean; readonly ok: boolean;
readonly redirected: boolean; readonly redirected: boolean;
@ -413,14 +413,14 @@ declare function fetch(
/** /**
* @category Fetch * @category Fetch
*/ */
declare interface EventSourceInit { interface EventSourceInit {
withCredentials?: boolean; withCredentials?: boolean;
} }
/** /**
* @category Fetch * @category Fetch
*/ */
declare interface EventSourceEventMap { interface EventSourceEventMap {
"error": Event; "error": Event;
"message": MessageEvent; "message": MessageEvent;
"open": Event; "open": Event;
@ -429,7 +429,7 @@ declare interface EventSourceEventMap {
/** /**
* @category Fetch * @category Fetch
*/ */
declare interface EventSource extends EventTarget { interface EventSource extends EventTarget {
onerror: ((this: EventSource, ev: Event) => any) | null; onerror: ((this: EventSource, ev: Event) => any) | null;
onmessage: ((this: EventSource, ev: MessageEvent) => any) | null; onmessage: ((this: EventSource, ev: MessageEvent) => any) | null;
onopen: ((this: EventSource, ev: Event) => any) | null; onopen: ((this: EventSource, ev: Event) => any) | null;

View file

@ -449,4 +449,6 @@ declare namespace Deno {
conn: TcpConn, conn: TcpConn,
options?: StartTlsOptions, options?: StartTlsOptions,
): Promise<TlsConn>; ): Promise<TlsConn>;
export {}; // only export exports
} }

View file

@ -6,7 +6,7 @@
/// <reference lib="esnext" /> /// <reference lib="esnext" />
/** @category URL */ /** @category URL */
declare interface URLSearchParams { interface URLSearchParams {
/** Appends a specified key/value pair as a new search parameter. /** Appends a specified key/value pair as a new search parameter.
* *
* ```ts * ```ts
@ -170,7 +170,7 @@ declare var URLSearchParams: {
* *
* @category URL * @category URL
*/ */
declare interface URL { interface URL {
hash: string; hash: string;
host: string; host: string;
hostname: string; hostname: string;
@ -202,7 +202,7 @@ declare var URL: {
}; };
/** @category URL */ /** @category URL */
declare interface URLPatternInit { interface URLPatternInit {
protocol?: string; protocol?: string;
username?: string; username?: string;
password?: string; password?: string;
@ -215,10 +215,10 @@ declare interface URLPatternInit {
} }
/** @category URL */ /** @category URL */
declare type URLPatternInput = string | URLPatternInit; type URLPatternInput = string | URLPatternInit;
/** @category URL */ /** @category URL */
declare interface URLPatternComponentResult { interface URLPatternComponentResult {
input: string; input: string;
groups: Record<string, string | undefined>; groups: Record<string, string | undefined>;
} }
@ -227,7 +227,7 @@ declare interface URLPatternComponentResult {
* *
* @category URL * @category URL
*/ */
declare interface URLPatternResult { interface URLPatternResult {
/** The inputs provided when matching. */ /** The inputs provided when matching. */
inputs: [URLPatternInit] | [URLPatternInit, string]; inputs: [URLPatternInit] | [URLPatternInit, string];
@ -254,7 +254,7 @@ declare interface URLPatternResult {
* *
* @category URL * @category URL
*/ */
declare interface URLPatternOptions { interface URLPatternOptions {
/** /**
* Enables case-insensitive matching. * Enables case-insensitive matching.
* *
@ -293,7 +293,7 @@ declare interface URLPatternOptions {
* *
* @category URL * @category URL
*/ */
declare interface URLPattern { interface URLPattern {
/** /**
* Test if the given input matches the stored pattern. * Test if the given input matches the stored pattern.
* *

View file

@ -71,5 +71,10 @@ interface ReadableStreamGenericReader<T> {
declare function queueMicrotask(callback: VoidFunction): void; declare function queueMicrotask(callback: VoidFunction): void;
declare namespace Deno { declare namespace Deno {
function inspect(value: unknown, options?: Record<string, unknown>): string; export function inspect(
value: unknown,
options?: Record<string, unknown>,
): string;
export {}; // only export exports
} }

View file

@ -6,7 +6,7 @@
/// <reference lib="esnext" /> /// <reference lib="esnext" />
/** @category Platform */ /** @category Platform */
declare interface DOMException extends Error { interface DOMException extends Error {
readonly name: string; readonly name: string;
readonly message: string; readonly message: string;
/** @deprecated */ /** @deprecated */
@ -70,7 +70,7 @@ declare var DOMException: {
}; };
/** @category Events */ /** @category Events */
declare interface EventInit { interface EventInit {
bubbles?: boolean; bubbles?: boolean;
cancelable?: boolean; cancelable?: boolean;
composed?: boolean; composed?: boolean;
@ -80,7 +80,7 @@ declare interface EventInit {
* *
* @category Events * @category Events
*/ */
declare interface Event { interface Event {
/** Returns true or false depending on how event was initialized. True if /** Returns true or false depending on how event was initialized. True if
* event goes through its target's ancestors in reverse tree order, and * event goes through its target's ancestors in reverse tree order, and
* false otherwise. */ * false otherwise. */
@ -163,7 +163,7 @@ declare var Event: {
* *
* @category Events * @category Events
*/ */
declare interface EventTarget { interface EventTarget {
/** Appends an event listener for events whose type attribute value is type. /** Appends an event listener for events whose type attribute value is type.
* The callback argument sets the callback that will be invoked when the event * The callback argument sets the callback that will be invoked when the event
* is dispatched. * is dispatched.
@ -217,34 +217,34 @@ declare var EventTarget: {
}; };
/** @category Events */ /** @category Events */
declare interface EventListener { interface EventListener {
(evt: Event): void; (evt: Event): void;
} }
/** @category Events */ /** @category Events */
declare interface EventListenerObject { interface EventListenerObject {
handleEvent(evt: Event): void; handleEvent(evt: Event): void;
} }
/** @category Events */ /** @category Events */
declare type EventListenerOrEventListenerObject = type EventListenerOrEventListenerObject =
| EventListener | EventListener
| EventListenerObject; | EventListenerObject;
/** @category Events */ /** @category Events */
declare interface AddEventListenerOptions extends EventListenerOptions { interface AddEventListenerOptions extends EventListenerOptions {
once?: boolean; once?: boolean;
passive?: boolean; passive?: boolean;
signal?: AbortSignal; signal?: AbortSignal;
} }
/** @category Events */ /** @category Events */
declare interface EventListenerOptions { interface EventListenerOptions {
capture?: boolean; capture?: boolean;
} }
/** @category Events */ /** @category Events */
declare interface ProgressEventInit extends EventInit { interface ProgressEventInit extends EventInit {
lengthComputable?: boolean; lengthComputable?: boolean;
loaded?: number; loaded?: number;
total?: number; total?: number;
@ -256,8 +256,7 @@ declare interface ProgressEventInit extends EventInit {
* *
* @category Events * @category Events
*/ */
declare interface ProgressEvent<T extends EventTarget = EventTarget> interface ProgressEvent<T extends EventTarget = EventTarget> extends Event {
extends Event {
readonly lengthComputable: boolean; readonly lengthComputable: boolean;
readonly loaded: number; readonly loaded: number;
readonly target: T | null; readonly target: T | null;
@ -296,13 +295,13 @@ declare function atob(s: string): string;
declare function btoa(s: string): string; declare function btoa(s: string): string;
/** @category Encoding */ /** @category Encoding */
declare interface TextDecoderOptions { interface TextDecoderOptions {
fatal?: boolean; fatal?: boolean;
ignoreBOM?: boolean; ignoreBOM?: boolean;
} }
/** @category Encoding */ /** @category Encoding */
declare interface TextDecodeOptions { interface TextDecodeOptions {
stream?: boolean; stream?: boolean;
} }
@ -320,7 +319,7 @@ declare interface TextDecodeOptions {
* *
* @category Encoding * @category Encoding
*/ */
declare interface TextDecoder extends TextDecoderCommon { interface TextDecoder extends TextDecoderCommon {
/** Turns binary data, often in the form of a Uint8Array, into a string given /** Turns binary data, often in the form of a Uint8Array, into a string given
* the encoding. * the encoding.
*/ */
@ -334,7 +333,7 @@ declare var TextDecoder: {
}; };
/** @category Encoding */ /** @category Encoding */
declare interface TextDecoderCommon { interface TextDecoderCommon {
/** Returns encoding's name, lowercased. */ /** Returns encoding's name, lowercased. */
readonly encoding: string; readonly encoding: string;
/** Returns true if error mode is "fatal", otherwise false. */ /** Returns true if error mode is "fatal", otherwise false. */
@ -344,13 +343,13 @@ declare interface TextDecoderCommon {
} }
/** @category Encoding */ /** @category Encoding */
declare interface TextEncoderEncodeIntoResult { interface TextEncoderEncodeIntoResult {
read: number; read: number;
written: number; written: number;
} }
/** @category Encoding */ /** @category Encoding */
declare interface TextEncoder extends TextEncoderCommon { interface TextEncoder extends TextEncoderCommon {
/** Returns the result of running UTF-8's encoder. */ /** Returns the result of running UTF-8's encoder. */
encode(input?: string): Uint8Array; encode(input?: string): Uint8Array;
encodeInto(input: string, dest: Uint8Array): TextEncoderEncodeIntoResult; encodeInto(input: string, dest: Uint8Array): TextEncoderEncodeIntoResult;
@ -369,7 +368,7 @@ declare interface TextEncoder extends TextEncoderCommon {
* *
* @category Encoding * @category Encoding
*/ */
declare interface TextEncoder extends TextEncoderCommon { interface TextEncoder extends TextEncoderCommon {
/** Turns a string into binary data (in the form of a Uint8Array) using UTF-8 encoding. */ /** Turns a string into binary data (in the form of a Uint8Array) using UTF-8 encoding. */
encode(input?: string): Uint8Array; encode(input?: string): Uint8Array;
@ -384,14 +383,13 @@ declare var TextEncoder: {
}; };
/** @category Encoding */ /** @category Encoding */
declare interface TextEncoderCommon { interface TextEncoderCommon {
/** Returns "utf-8". */ /** Returns "utf-8". */
readonly encoding: string; readonly encoding: string;
} }
/** @category Encoding */ /** @category Encoding */
declare interface TextDecoderStream interface TextDecoderStream extends GenericTransformStream, TextDecoderCommon {
extends GenericTransformStream, TextDecoderCommon {
readonly readable: ReadableStream<string>; readonly readable: ReadableStream<string>;
readonly writable: WritableStream<BufferSource>; readonly writable: WritableStream<BufferSource>;
} }
@ -403,8 +401,7 @@ declare var TextDecoderStream: {
}; };
/** @category Encoding */ /** @category Encoding */
declare interface TextEncoderStream interface TextEncoderStream extends GenericTransformStream, TextEncoderCommon {
extends GenericTransformStream, TextEncoderCommon {
readonly readable: ReadableStream<Uint8Array>; readonly readable: ReadableStream<Uint8Array>;
readonly writable: WritableStream<string>; readonly writable: WritableStream<string>;
} }
@ -420,7 +417,7 @@ declare var TextEncoderStream: {
* *
* @category Platform * @category Platform
*/ */
declare interface AbortController { interface AbortController {
/** Returns the AbortSignal object associated with this object. */ /** Returns the AbortSignal object associated with this object. */
readonly signal: AbortSignal; readonly signal: AbortSignal;
/** Invoking this method will set this object's AbortSignal's aborted flag and /** Invoking this method will set this object's AbortSignal's aborted flag and
@ -439,7 +436,7 @@ declare var AbortController: {
}; };
/** @category Platform */ /** @category Platform */
declare interface AbortSignalEventMap { interface AbortSignalEventMap {
abort: Event; abort: Event;
} }
@ -448,7 +445,7 @@ declare interface AbortSignalEventMap {
* *
* @category Platform * @category Platform
*/ */
declare interface AbortSignal extends EventTarget { interface AbortSignal extends EventTarget {
/** Returns true if this AbortSignal's AbortController has signaled to abort, /** Returns true if this AbortSignal's AbortController has signaled to abort,
* and false otherwise. */ * and false otherwise. */
readonly aborted: boolean; readonly aborted: boolean;
@ -490,7 +487,7 @@ declare var AbortSignal: {
}; };
/** @category File */ /** @category File */
declare interface FileReaderEventMap { interface FileReaderEventMap {
"abort": ProgressEvent<FileReader>; "abort": ProgressEvent<FileReader>;
"error": ProgressEvent<FileReader>; "error": ProgressEvent<FileReader>;
"load": ProgressEvent<FileReader>; "load": ProgressEvent<FileReader>;
@ -505,7 +502,7 @@ declare interface FileReaderEventMap {
* *
* @category File * @category File
*/ */
declare interface FileReader extends EventTarget { interface FileReader extends EventTarget {
readonly error: DOMException | null; readonly error: DOMException | null;
onabort: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null; onabort: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null;
onerror: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null; onerror: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null;
@ -561,13 +558,13 @@ declare var FileReader: {
}; };
/** @category File */ /** @category File */
declare type BlobPart = BufferSource | Blob | string; type BlobPart = BufferSource | Blob | string;
/** @category File */ /** @category File */
declare type EndingType = "transparent" | "native"; type EndingType = "transparent" | "native";
/** @category File */ /** @category File */
declare interface BlobPropertyBag { interface BlobPropertyBag {
type?: string; type?: string;
endings?: EndingType; endings?: EndingType;
} }
@ -579,7 +576,7 @@ declare interface BlobPropertyBag {
* *
* @category File * @category File
*/ */
declare interface Blob { interface Blob {
readonly size: number; readonly size: number;
readonly type: string; readonly type: string;
arrayBuffer(): Promise<ArrayBuffer>; arrayBuffer(): Promise<ArrayBuffer>;
@ -602,7 +599,7 @@ declare var Blob: {
}; };
/** @category File */ /** @category File */
declare interface FilePropertyBag extends BlobPropertyBag { interface FilePropertyBag extends BlobPropertyBag {
lastModified?: number; lastModified?: number;
} }
@ -611,7 +608,7 @@ declare interface FilePropertyBag extends BlobPropertyBag {
* *
* @category File * @category File
*/ */
declare interface File extends Blob { interface File extends Blob {
readonly lastModified: number; readonly lastModified: number;
readonly name: string; readonly name: string;
readonly webkitRelativePath: string; readonly webkitRelativePath: string;
@ -628,40 +625,40 @@ declare var File: {
}; };
/** @category Streams */ /** @category Streams */
declare type ReadableStreamReader<T> = type ReadableStreamReader<T> =
| ReadableStreamDefaultReader<T> | ReadableStreamDefaultReader<T>
| ReadableStreamBYOBReader; | ReadableStreamBYOBReader;
/** @category Streams */ /** @category Streams */
declare type ReadableStreamController<T> = type ReadableStreamController<T> =
| ReadableStreamDefaultController<T> | ReadableStreamDefaultController<T>
| ReadableByteStreamController; | ReadableByteStreamController;
/** @category Streams */ /** @category Streams */
declare interface ReadableStreamGenericReader { interface ReadableStreamGenericReader {
readonly closed: Promise<undefined>; readonly closed: Promise<undefined>;
cancel(reason?: any): Promise<void>; cancel(reason?: any): Promise<void>;
} }
/** @category Streams */ /** @category Streams */
declare interface ReadableStreamReadDoneResult<T> { interface ReadableStreamReadDoneResult<T> {
done: true; done: true;
value?: T; value?: T;
} }
/** @category Streams */ /** @category Streams */
declare interface ReadableStreamReadValueResult<T> { interface ReadableStreamReadValueResult<T> {
done: false; done: false;
value: T; value: T;
} }
/** @category Streams */ /** @category Streams */
declare type ReadableStreamReadResult<T> = type ReadableStreamReadResult<T> =
| ReadableStreamReadValueResult<T> | ReadableStreamReadValueResult<T>
| ReadableStreamReadDoneResult<T>; | ReadableStreamReadDoneResult<T>;
/** @category Streams */ /** @category Streams */
declare interface ReadableStreamDefaultReader<R = any> interface ReadableStreamDefaultReader<R = any>
extends ReadableStreamGenericReader { extends ReadableStreamGenericReader {
read(): Promise<ReadableStreamReadResult<R>>; read(): Promise<ReadableStreamReadResult<R>>;
releaseLock(): void; releaseLock(): void;
@ -674,12 +671,12 @@ declare var ReadableStreamDefaultReader: {
}; };
/** @category Streams */ /** @category Streams */
declare interface ReadableStreamBYOBReaderReadOptions { interface ReadableStreamBYOBReaderReadOptions {
min?: number; min?: number;
} }
/** @category Streams */ /** @category Streams */
declare interface ReadableStreamBYOBReader extends ReadableStreamGenericReader { interface ReadableStreamBYOBReader extends ReadableStreamGenericReader {
read<T extends ArrayBufferView>( read<T extends ArrayBufferView>(
view: T, view: T,
options?: ReadableStreamBYOBReaderReadOptions, options?: ReadableStreamBYOBReaderReadOptions,
@ -694,7 +691,7 @@ declare var ReadableStreamBYOBReader: {
}; };
/** @category Streams */ /** @category Streams */
declare interface ReadableStreamBYOBRequest { interface ReadableStreamBYOBRequest {
readonly view: ArrayBufferView | null; readonly view: ArrayBufferView | null;
respond(bytesWritten: number): void; respond(bytesWritten: number): void;
respondWithNewView(view: ArrayBufferView): void; respondWithNewView(view: ArrayBufferView): void;
@ -707,7 +704,7 @@ declare var ReadableStreamBYOBRequest: {
}; };
/** @category Streams */ /** @category Streams */
declare interface UnderlyingByteSource { interface UnderlyingByteSource {
autoAllocateChunkSize?: number; autoAllocateChunkSize?: number;
cancel?: UnderlyingSourceCancelCallback; cancel?: UnderlyingSourceCancelCallback;
pull?: (controller: ReadableByteStreamController) => void | PromiseLike<void>; pull?: (controller: ReadableByteStreamController) => void | PromiseLike<void>;
@ -716,7 +713,7 @@ declare interface UnderlyingByteSource {
} }
/** @category Streams */ /** @category Streams */
declare interface UnderlyingDefaultSource<R = any> { interface UnderlyingDefaultSource<R = any> {
cancel?: UnderlyingSourceCancelCallback; cancel?: UnderlyingSourceCancelCallback;
pull?: ( pull?: (
controller: ReadableStreamDefaultController<R>, controller: ReadableStreamDefaultController<R>,
@ -726,7 +723,7 @@ declare interface UnderlyingDefaultSource<R = any> {
} }
/** @category Streams */ /** @category Streams */
declare interface UnderlyingSink<W = any> { interface UnderlyingSink<W = any> {
abort?: UnderlyingSinkAbortCallback; abort?: UnderlyingSinkAbortCallback;
close?: UnderlyingSinkCloseCallback; close?: UnderlyingSinkCloseCallback;
start?: UnderlyingSinkStartCallback; start?: UnderlyingSinkStartCallback;
@ -735,10 +732,10 @@ declare interface UnderlyingSink<W = any> {
} }
/** @category Streams */ /** @category Streams */
declare type ReadableStreamType = "bytes"; type ReadableStreamType = "bytes";
/** @category Streams */ /** @category Streams */
declare interface UnderlyingSource<R = any> { interface UnderlyingSource<R = any> {
autoAllocateChunkSize?: number; autoAllocateChunkSize?: number;
cancel?: UnderlyingSourceCancelCallback; cancel?: UnderlyingSourceCancelCallback;
pull?: UnderlyingSourcePullCallback<R>; pull?: UnderlyingSourcePullCallback<R>;
@ -747,22 +744,22 @@ declare interface UnderlyingSource<R = any> {
} }
/** @category Streams */ /** @category Streams */
declare interface UnderlyingSourceCancelCallback { interface UnderlyingSourceCancelCallback {
(reason?: any): void | PromiseLike<void>; (reason?: any): void | PromiseLike<void>;
} }
/** @category Streams */ /** @category Streams */
declare interface UnderlyingSourcePullCallback<R> { interface UnderlyingSourcePullCallback<R> {
(controller: ReadableStreamController<R>): void | PromiseLike<void>; (controller: ReadableStreamController<R>): void | PromiseLike<void>;
} }
/** @category Streams */ /** @category Streams */
declare interface UnderlyingSourceStartCallback<R> { interface UnderlyingSourceStartCallback<R> {
(controller: ReadableStreamController<R>): any; (controller: ReadableStreamController<R>): any;
} }
/** @category Streams */ /** @category Streams */
declare interface ReadableStreamDefaultController<R = any> { interface ReadableStreamDefaultController<R = any> {
readonly desiredSize: number | null; readonly desiredSize: number | null;
close(): void; close(): void;
enqueue(chunk?: R): void; enqueue(chunk?: R): void;
@ -776,7 +773,7 @@ declare var ReadableStreamDefaultController: {
}; };
/** @category Streams */ /** @category Streams */
declare interface ReadableByteStreamController { interface ReadableByteStreamController {
readonly byobRequest: ReadableStreamBYOBRequest | null; readonly byobRequest: ReadableStreamBYOBRequest | null;
readonly desiredSize: number | null; readonly desiredSize: number | null;
close(): void; close(): void;
@ -791,7 +788,7 @@ declare var ReadableByteStreamController: {
}; };
/** @category Streams */ /** @category Streams */
declare interface StreamPipeOptions { interface StreamPipeOptions {
preventAbort?: boolean; preventAbort?: boolean;
preventCancel?: boolean; preventCancel?: boolean;
preventClose?: boolean; preventClose?: boolean;
@ -799,12 +796,12 @@ declare interface StreamPipeOptions {
} }
/** @category Streams */ /** @category Streams */
declare interface QueuingStrategySize<T = any> { interface QueuingStrategySize<T = any> {
(chunk: T): number; (chunk: T): number;
} }
/** @category Streams */ /** @category Streams */
declare interface QueuingStrategy<T = any> { interface QueuingStrategy<T = any> {
highWaterMark?: number; highWaterMark?: number;
size?: QueuingStrategySize<T>; size?: QueuingStrategySize<T>;
} }
@ -814,7 +811,7 @@ declare interface QueuingStrategy<T = any> {
* *
* @category Streams * @category Streams
*/ */
declare interface CountQueuingStrategy extends QueuingStrategy { interface CountQueuingStrategy extends QueuingStrategy {
readonly highWaterMark: number; readonly highWaterMark: number;
readonly size: QueuingStrategySize; readonly size: QueuingStrategySize;
} }
@ -826,8 +823,7 @@ declare var CountQueuingStrategy: {
}; };
/** @category Streams */ /** @category Streams */
declare interface ByteLengthQueuingStrategy interface ByteLengthQueuingStrategy extends QueuingStrategy<ArrayBufferView> {
extends QueuingStrategy<ArrayBufferView> {
readonly highWaterMark: number; readonly highWaterMark: number;
readonly size: QueuingStrategySize<ArrayBufferView>; readonly size: QueuingStrategySize<ArrayBufferView>;
} }
@ -839,7 +835,7 @@ declare var ByteLengthQueuingStrategy: {
}; };
/** @category Streams */ /** @category Streams */
declare interface QueuingStrategyInit { interface QueuingStrategyInit {
highWaterMark: number; highWaterMark: number;
} }
@ -849,7 +845,7 @@ declare interface QueuingStrategyInit {
* *
* @category Streams * @category Streams
*/ */
declare interface ReadableStream<R = any> { interface ReadableStream<R = any> {
readonly locked: boolean; readonly locked: boolean;
cancel(reason?: any): Promise<void>; cancel(reason?: any): Promise<void>;
getReader(options: { mode: "byob" }): ReadableStreamBYOBReader; getReader(options: { mode: "byob" }): ReadableStreamBYOBReader;
@ -891,36 +887,36 @@ declare var ReadableStream: {
}; };
/** @category Streams */ /** @category Streams */
declare interface ReadableStreamIteratorOptions { interface ReadableStreamIteratorOptions {
preventCancel?: boolean; preventCancel?: boolean;
} }
/** @category Streams */ /** @category Streams */
declare type ReadableStreamReaderMode = "byob"; type ReadableStreamReaderMode = "byob";
/** @category Streams */ /** @category Streams */
declare interface ReadableStreamGetReaderOptions { interface ReadableStreamGetReaderOptions {
mode?: ReadableStreamReaderMode; mode?: ReadableStreamReaderMode;
} }
/** @category Streams */ /** @category Streams */
declare interface ReadableWritablePair<R = any, W = any> { interface ReadableWritablePair<R = any, W = any> {
readable: ReadableStream<R>; readable: ReadableStream<R>;
writable: WritableStream<W>; writable: WritableStream<W>;
} }
/** @category Streams */ /** @category Streams */
declare interface UnderlyingSinkCloseCallback { interface UnderlyingSinkCloseCallback {
(): void | PromiseLike<void>; (): void | PromiseLike<void>;
} }
/** @category Streams */ /** @category Streams */
declare interface UnderlyingSinkStartCallback { interface UnderlyingSinkStartCallback {
(controller: WritableStreamDefaultController): any; (controller: WritableStreamDefaultController): any;
} }
/** @category Streams */ /** @category Streams */
declare interface UnderlyingSinkWriteCallback<W> { interface UnderlyingSinkWriteCallback<W> {
( (
chunk: W, chunk: W,
controller: WritableStreamDefaultController, controller: WritableStreamDefaultController,
@ -928,7 +924,7 @@ declare interface UnderlyingSinkWriteCallback<W> {
} }
/** @category Streams */ /** @category Streams */
declare interface UnderlyingSinkAbortCallback { interface UnderlyingSinkAbortCallback {
(reason?: any): void | PromiseLike<void>; (reason?: any): void | PromiseLike<void>;
} }
@ -938,7 +934,7 @@ declare interface UnderlyingSinkAbortCallback {
* *
* @category Streams * @category Streams
*/ */
declare interface WritableStream<W = any> { interface WritableStream<W = any> {
readonly locked: boolean; readonly locked: boolean;
abort(reason?: any): Promise<void>; abort(reason?: any): Promise<void>;
close(): Promise<void>; close(): Promise<void>;
@ -961,7 +957,7 @@ declare var WritableStream: {
* *
* @category Streams * @category Streams
*/ */
declare interface WritableStreamDefaultController { interface WritableStreamDefaultController {
readonly signal: AbortSignal; readonly signal: AbortSignal;
error(e?: any): void; error(e?: any): void;
} }
@ -979,7 +975,7 @@ declare var WritableStreamDefaultController: {
* *
* @category Streams * @category Streams
*/ */
declare interface WritableStreamDefaultWriter<W = any> { interface WritableStreamDefaultWriter<W = any> {
readonly closed: Promise<undefined>; readonly closed: Promise<undefined>;
readonly desiredSize: number | null; readonly desiredSize: number | null;
readonly ready: Promise<undefined>; readonly ready: Promise<undefined>;
@ -996,7 +992,7 @@ declare var WritableStreamDefaultWriter: {
}; };
/** @category Streams */ /** @category Streams */
declare interface TransformStream<I = any, O = any> { interface TransformStream<I = any, O = any> {
readonly readable: ReadableStream<O>; readonly readable: ReadableStream<O>;
readonly writable: WritableStream<I>; readonly writable: WritableStream<I>;
} }
@ -1012,7 +1008,7 @@ declare var TransformStream: {
}; };
/** @category Streams */ /** @category Streams */
declare interface TransformStreamDefaultController<O = any> { interface TransformStreamDefaultController<O = any> {
readonly desiredSize: number | null; readonly desiredSize: number | null;
enqueue(chunk?: O): void; enqueue(chunk?: O): void;
error(reason?: any): void; error(reason?: any): void;
@ -1026,7 +1022,7 @@ declare var TransformStreamDefaultController: {
}; };
/** @category Streams */ /** @category Streams */
declare interface Transformer<I = any, O = any> { interface Transformer<I = any, O = any> {
flush?: TransformerFlushCallback<O>; flush?: TransformerFlushCallback<O>;
readableType?: undefined; readableType?: undefined;
start?: TransformerStartCallback<O>; start?: TransformerStartCallback<O>;
@ -1036,17 +1032,17 @@ declare interface Transformer<I = any, O = any> {
} }
/** @category Streams */ /** @category Streams */
declare interface TransformerFlushCallback<O> { interface TransformerFlushCallback<O> {
(controller: TransformStreamDefaultController<O>): void | PromiseLike<void>; (controller: TransformStreamDefaultController<O>): void | PromiseLike<void>;
} }
/** @category Streams */ /** @category Streams */
declare interface TransformerStartCallback<O> { interface TransformerStartCallback<O> {
(controller: TransformStreamDefaultController<O>): any; (controller: TransformStreamDefaultController<O>): any;
} }
/** @category Streams */ /** @category Streams */
declare interface TransformerTransformCallback<I, O> { interface TransformerTransformCallback<I, O> {
( (
chunk: I, chunk: I,
controller: TransformStreamDefaultController<O>, controller: TransformStreamDefaultController<O>,
@ -1054,21 +1050,21 @@ declare interface TransformerTransformCallback<I, O> {
} }
/** @category Streams */ /** @category Streams */
declare interface TransformerCancelCallback { interface TransformerCancelCallback {
(reason: any): void | PromiseLike<void>; (reason: any): void | PromiseLike<void>;
} }
/** @category Streams */ /** @category Streams */
declare interface GenericTransformStream { interface GenericTransformStream {
readonly readable: ReadableStream; readonly readable: ReadableStream;
readonly writable: WritableStream; readonly writable: WritableStream;
} }
/** @category Events */ /** @category Events */
declare type MessageEventSource = Window | MessagePort; type MessageEventSource = Window | MessagePort;
/** @category Events */ /** @category Events */
declare interface MessageEventInit<T = any> extends EventInit { interface MessageEventInit<T = any> extends EventInit {
data?: T; data?: T;
lastEventId?: string; lastEventId?: string;
origin?: string; origin?: string;
@ -1077,7 +1073,7 @@ declare interface MessageEventInit<T = any> extends EventInit {
} }
/** @category Events */ /** @category Events */
declare interface MessageEvent<T = any> extends Event { interface MessageEvent<T = any> extends Event {
/** /**
* Returns the data of the message. * Returns the data of the message.
*/ */
@ -1115,10 +1111,10 @@ declare var MessageEvent: {
}; };
/** @category Events */ /** @category Events */
declare type Transferable = MessagePort | ArrayBuffer; type Transferable = MessagePort | ArrayBuffer;
/** @category Platform */ /** @category Platform */
declare interface StructuredSerializeOptions { interface StructuredSerializeOptions {
transfer?: Transferable[]; transfer?: Transferable[];
} }
@ -1128,7 +1124,7 @@ declare interface StructuredSerializeOptions {
* *
* @category Messaging * @category Messaging
*/ */
declare interface MessageChannel { interface MessageChannel {
readonly port1: MessagePort; readonly port1: MessagePort;
readonly port2: MessagePort; readonly port2: MessagePort;
} }
@ -1145,7 +1141,7 @@ declare var MessageChannel: {
}; };
/** @category Messaging */ /** @category Messaging */
declare interface MessagePortEventMap { interface MessagePortEventMap {
"message": MessageEvent; "message": MessageEvent;
"messageerror": MessageEvent; "messageerror": MessageEvent;
} }
@ -1156,7 +1152,7 @@ declare interface MessagePortEventMap {
* *
* @category Messaging * @category Messaging
*/ */
declare interface MessagePort extends EventTarget { interface MessagePort extends EventTarget {
onmessage: ((this: MessagePort, ev: MessageEvent) => any) | null; onmessage: ((this: MessagePort, ev: MessageEvent) => any) | null;
onmessageerror: ((this: MessagePort, ev: MessageEvent) => any) | null; onmessageerror: ((this: MessagePort, ev: MessageEvent) => any) | null;
/** /**
@ -1255,13 +1251,13 @@ declare function structuredClone<T = any>(
* *
* @category Streams * @category Streams
*/ */
declare interface CompressionStream extends GenericTransformStream { interface CompressionStream extends GenericTransformStream {
readonly readable: ReadableStream<Uint8Array>; readonly readable: ReadableStream<Uint8Array>;
readonly writable: WritableStream<BufferSource>; readonly writable: WritableStream<BufferSource>;
} }
/** @category Streams */ /** @category Streams */
declare type CompressionFormat = "deflate" | "deflate-raw" | "gzip"; type CompressionFormat = "deflate" | "deflate-raw" | "gzip";
/** /**
* An API for compressing a stream of data. * An API for compressing a stream of data.
@ -1302,7 +1298,7 @@ declare var CompressionStream: {
* *
* @category Streams * @category Streams
*/ */
declare interface DecompressionStream extends GenericTransformStream { interface DecompressionStream extends GenericTransformStream {
readonly readable: ReadableStream<Uint8Array>; readonly readable: ReadableStream<Uint8Array>;
readonly writable: WritableStream<BufferSource>; readonly writable: WritableStream<BufferSource>;
} }
@ -1356,15 +1352,15 @@ declare function reportError(
): void; ): void;
/** @category Platform */ /** @category Platform */
declare type PredefinedColorSpace = "srgb" | "display-p3"; type PredefinedColorSpace = "srgb" | "display-p3";
/** @category Platform */ /** @category Platform */
declare interface ImageDataSettings { interface ImageDataSettings {
readonly colorSpace?: PredefinedColorSpace; readonly colorSpace?: PredefinedColorSpace;
} }
/** @category Platform */ /** @category Platform */
declare interface ImageData { interface ImageData {
readonly colorSpace: PredefinedColorSpace; readonly colorSpace: PredefinedColorSpace;
readonly data: Uint8ClampedArray; readonly data: Uint8ClampedArray;
readonly height: number; readonly height: number;

View file

@ -6,14 +6,14 @@
/// <reference lib="esnext" /> /// <reference lib="esnext" />
/** @category WebSockets */ /** @category WebSockets */
declare interface CloseEventInit extends EventInit { interface CloseEventInit extends EventInit {
code?: number; code?: number;
reason?: string; reason?: string;
wasClean?: boolean; wasClean?: boolean;
} }
/** @category WebSockets */ /** @category WebSockets */
declare interface CloseEvent extends Event { interface CloseEvent extends Event {
/** /**
* Returns the WebSocket connection close code provided by the server. * Returns the WebSocket connection close code provided by the server.
*/ */
@ -35,7 +35,7 @@ declare var CloseEvent: {
}; };
/** @category WebSockets */ /** @category WebSockets */
declare interface WebSocketEventMap { interface WebSocketEventMap {
close: CloseEvent; close: CloseEvent;
error: Event; error: Event;
message: MessageEvent; message: MessageEvent;
@ -52,7 +52,7 @@ declare interface WebSocketEventMap {
* @tags allow-net * @tags allow-net
* @category WebSockets * @category WebSockets
*/ */
declare interface WebSocket extends EventTarget { interface WebSocket extends EventTarget {
/** /**
* Returns a string that indicates how binary data from the WebSocket object is exposed to scripts: * Returns a string that indicates how binary data from the WebSocket object is exposed to scripts:
* *
@ -130,4 +130,4 @@ declare var WebSocket: {
}; };
/** @category WebSockets */ /** @category WebSockets */
declare type BinaryType = "arraybuffer" | "blob"; type BinaryType = "arraybuffer" | "blob";

View file

@ -11,7 +11,7 @@
* *
* @category Storage * @category Storage
*/ */
declare interface Storage { interface Storage {
/** /**
* Returns the number of key/value pairs currently present in the list associated with the object. * Returns the number of key/value pairs currently present in the list associated with the object.
*/ */

100
tools/generate_types_deno.ts Executable file
View file

@ -0,0 +1,100 @@
#!/usr/bin/env -S deno run -A
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
// This script is used to generate the @types/deno package on DefinitelyTyped.
import $ from "jsr:@david/dax@0.42.0";
import { Node, Project } from "jsr:@ts-morph/ts-morph@23.0.0";
import * as semver from "jsr:@std/semver@1.0.3";
const rootDir = $.path(import.meta.dirname!).parentOrThrow();
const definitelyTypedDir = rootDir.join(
"../DefinitelyTyped/types/deno/",
);
if (!definitelyTypedDir.existsSync()) {
throw new Error(`Makes sure ${definitelyTypedDir} exists.`);
}
const denoExec = rootDir.join(
"target/debug/deno" + (Deno.build.os === "windows" ? ".exe" : ""),
);
$.logStep("Building Deno executable...");
await $`cargo build`;
$.logStep("Creating declaration file...");
await createDenoDtsFile();
$.logStep("Updating package.json...");
await updatePkgJson();
$.logStep("Formatting...");
await $`pnpm dprint fmt`.cwd(definitelyTypedDir);
async function createDenoDtsFile() {
function matchesAny(text: string | undefined, patterns: string[]): boolean {
if (text == null) {
return false;
}
for (const pattern of patterns) {
if (text.includes(pattern)) {
return true;
}
}
return false;
}
const text = await $`${denoExec} types`.text();
const project = new Project();
const file = project.createSourceFile(
definitelyTypedDir.join("index.d.ts").toString(),
text,
{
overwrite: true,
},
);
for (const statement of file.getStatementsWithComments()) {
if (Node.isCommentStatement(statement)) {
const statementText = statement.getText();
if (statementText.includes("<reference")) {
statement.remove();
continue;
}
}
const shouldKeepKeep = (Node.isModuleDeclaration(statement) ||
Node.isInterfaceDeclaration(statement) ||
Node.isTypeAliasDeclaration(statement) ||
Node.isClassDeclaration(statement)) &&
(matchesAny(statement.getName(), [
"Deno",
]) || statement.getName()?.startsWith("GPU"));
if (!shouldKeepKeep) {
statement.remove();
continue;
}
}
file.insertStatements(
0,
"// Copyright 2018-2024 the Deno authors. MIT license.\n\n",
);
file.saveSync();
}
async function updatePkgJson() {
const pkgJsonFile = definitelyTypedDir.join("package.json");
const obj = pkgJsonFile.readJsonSync();
const version = semver.parse(await getDenoVersion());
version.patch = 9999;
version.prerelease = undefined;
version.build = undefined;
// deno-lint-ignore no-explicit-any
(obj as any).version = semver.format(version);
pkgJsonFile.writeTextSync(JSON.stringify(obj, undefined, 4) + "\n"); // 4 spaces indent
}
async function getDenoVersion() {
const text = await $`${denoExec} -v`.text();
return text.match(/deno (.*)/)![1];
}

View file

@ -45,33 +45,39 @@ for (const file of project.getSourceFiles()) {
} }
const parent = node.getFirstAncestorByKind(ts.SyntaxKind.ModuleDeclaration); const parent = node.getFirstAncestorByKind(ts.SyntaxKind.ModuleDeclaration);
const isInterfaceOrType =
node.getKind() === ts.SyntaxKind.InterfaceDeclaration ||
node.getKind() === ts.SyntaxKind.TypeAliasDeclaration;
if (parent) { if (parent) {
if (!node.isExported()) { if (!node.isExported()) {
errors.push(getErrorPrefix(node) + "export keyword"); errors.push(getMissingErrorPrefix(node) + "export keyword");
continue; continue;
} }
} else if (!node.hasDeclareKeyword()) { } else if (!isInterfaceOrType && !node.hasDeclareKeyword()) {
errors.push(getErrorPrefix(node) + "declare keyword"); errors.push(getMissingErrorPrefix(node) + "declare keyword");
continue;
} else if (isInterfaceOrType && node.hasDeclareKeyword()) {
errors.push(getErrorPrefix(node) + "has incorrect declare keyword");
continue; continue;
} }
const jsDoc = node.getFirstChildIfKind(ts.SyntaxKind.JSDoc); const jsDoc = node.getFirstChildIfKind(ts.SyntaxKind.JSDoc);
if (!jsDoc) { if (!jsDoc) {
errors.push(getErrorPrefix(node) + "JSDoc comment"); errors.push(getMissingErrorPrefix(node) + "JSDoc comment");
continue; continue;
} }
const tags = jsDoc.getTags(); const tags = jsDoc.getTags();
if (!tags.find((tag) => tag.getTagName() === "category")) { if (!tags.find((tag) => tag.getTagName() === "category")) {
errors.push(getErrorPrefix(node) + "JSDoc @category tag"); errors.push(getMissingErrorPrefix(node) + "JSDoc @category tag");
continue; continue;
} }
if (unstableFiles.includes(file)) { if (unstableFiles.includes(file)) {
if (!tags.find((tag) => tag.getTagName() === "experimental")) { if (!tags.find((tag) => tag.getTagName() === "experimental")) {
errors.push(getErrorPrefix(node) + "JSDoc @experimental tag"); errors.push(getMissingErrorPrefix(node) + "JSDoc @experimental tag");
} }
} }
} }
@ -81,6 +87,10 @@ if (errors.length > 0) {
throw new AggregateError(errors); throw new AggregateError(errors);
} }
function getErrorPrefix(node) { function getMissingErrorPrefix(node) {
return `Symbol at file://${node.getSourceFile().getFilePath()}:${node.getStartLineNumber()} is missing a `; return getErrorPrefix(node) + `is missing a `;
}
function getErrorPrefix(node) {
return `Symbol at file://${node.getSourceFile().getFilePath()}:${node.getStartLineNumber()} `;
} }