Init commit.
This commit is contained in:
34
@types/node/web-globals/abortcontroller.d.ts
vendored
Normal file
34
@types/node/web-globals/abortcontroller.d.ts
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
export {};
|
||||
|
||||
type _AbortController = typeof globalThis extends { onmessage: any } ? {} : AbortController;
|
||||
interface AbortController {
|
||||
readonly signal: AbortSignal;
|
||||
abort(reason?: any): void;
|
||||
}
|
||||
|
||||
type _AbortSignal = typeof globalThis extends { onmessage: any } ? {} : AbortSignal;
|
||||
interface AbortSignal extends EventTarget {
|
||||
readonly aborted: boolean;
|
||||
onabort: ((this: AbortSignal, ev: Event) => any) | null;
|
||||
readonly reason: any;
|
||||
throwIfAborted(): void;
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface AbortController extends _AbortController {}
|
||||
var AbortController: typeof globalThis extends { onmessage: any; AbortController: infer T } ? T
|
||||
: {
|
||||
prototype: AbortController;
|
||||
new(): AbortController;
|
||||
};
|
||||
|
||||
interface AbortSignal extends _AbortSignal {}
|
||||
var AbortSignal: typeof globalThis extends { onmessage: any; AbortSignal: infer T } ? T
|
||||
: {
|
||||
prototype: AbortSignal;
|
||||
new(): AbortSignal;
|
||||
abort(reason?: any): AbortSignal;
|
||||
any(signals: AbortSignal[]): AbortSignal;
|
||||
timeout(milliseconds: number): AbortSignal;
|
||||
};
|
||||
}
|
||||
68
@types/node/web-globals/domexception.d.ts
vendored
Normal file
68
@types/node/web-globals/domexception.d.ts
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
export {};
|
||||
|
||||
type _DOMException = typeof globalThis extends { onmessage: any } ? {} : DOMException;
|
||||
interface DOMException extends Error {
|
||||
readonly code: number;
|
||||
readonly message: string;
|
||||
readonly name: string;
|
||||
readonly INDEX_SIZE_ERR: 1;
|
||||
readonly DOMSTRING_SIZE_ERR: 2;
|
||||
readonly HIERARCHY_REQUEST_ERR: 3;
|
||||
readonly WRONG_DOCUMENT_ERR: 4;
|
||||
readonly INVALID_CHARACTER_ERR: 5;
|
||||
readonly NO_DATA_ALLOWED_ERR: 6;
|
||||
readonly NO_MODIFICATION_ALLOWED_ERR: 7;
|
||||
readonly NOT_FOUND_ERR: 8;
|
||||
readonly NOT_SUPPORTED_ERR: 9;
|
||||
readonly INUSE_ATTRIBUTE_ERR: 10;
|
||||
readonly INVALID_STATE_ERR: 11;
|
||||
readonly SYNTAX_ERR: 12;
|
||||
readonly INVALID_MODIFICATION_ERR: 13;
|
||||
readonly NAMESPACE_ERR: 14;
|
||||
readonly INVALID_ACCESS_ERR: 15;
|
||||
readonly VALIDATION_ERR: 16;
|
||||
readonly TYPE_MISMATCH_ERR: 17;
|
||||
readonly SECURITY_ERR: 18;
|
||||
readonly NETWORK_ERR: 19;
|
||||
readonly ABORT_ERR: 20;
|
||||
readonly URL_MISMATCH_ERR: 21;
|
||||
readonly QUOTA_EXCEEDED_ERR: 22;
|
||||
readonly TIMEOUT_ERR: 23;
|
||||
readonly INVALID_NODE_TYPE_ERR: 24;
|
||||
readonly DATA_CLONE_ERR: 25;
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface DOMException extends _DOMException {}
|
||||
var DOMException: typeof globalThis extends { onmessage: any; DOMException: infer T } ? T
|
||||
: {
|
||||
prototype: DOMException;
|
||||
new(message?: string, name?: string): DOMException;
|
||||
new(message?: string, options?: { name?: string; cause?: unknown }): DOMException;
|
||||
readonly INDEX_SIZE_ERR: 1;
|
||||
readonly DOMSTRING_SIZE_ERR: 2;
|
||||
readonly HIERARCHY_REQUEST_ERR: 3;
|
||||
readonly WRONG_DOCUMENT_ERR: 4;
|
||||
readonly INVALID_CHARACTER_ERR: 5;
|
||||
readonly NO_DATA_ALLOWED_ERR: 6;
|
||||
readonly NO_MODIFICATION_ALLOWED_ERR: 7;
|
||||
readonly NOT_FOUND_ERR: 8;
|
||||
readonly NOT_SUPPORTED_ERR: 9;
|
||||
readonly INUSE_ATTRIBUTE_ERR: 10;
|
||||
readonly INVALID_STATE_ERR: 11;
|
||||
readonly SYNTAX_ERR: 12;
|
||||
readonly INVALID_MODIFICATION_ERR: 13;
|
||||
readonly NAMESPACE_ERR: 14;
|
||||
readonly INVALID_ACCESS_ERR: 15;
|
||||
readonly VALIDATION_ERR: 16;
|
||||
readonly TYPE_MISMATCH_ERR: 17;
|
||||
readonly SECURITY_ERR: 18;
|
||||
readonly NETWORK_ERR: 19;
|
||||
readonly ABORT_ERR: 20;
|
||||
readonly URL_MISMATCH_ERR: 21;
|
||||
readonly QUOTA_EXCEEDED_ERR: 22;
|
||||
readonly TIMEOUT_ERR: 23;
|
||||
readonly INVALID_NODE_TYPE_ERR: 24;
|
||||
readonly DATA_CLONE_ERR: 25;
|
||||
};
|
||||
}
|
||||
94
@types/node/web-globals/events.d.ts
vendored
Normal file
94
@types/node/web-globals/events.d.ts
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
export {};
|
||||
|
||||
interface AddEventListenerOptions extends EventListenerOptions {
|
||||
once?: boolean;
|
||||
passive?: boolean;
|
||||
signal?: AbortSignal;
|
||||
}
|
||||
|
||||
type _CustomEvent<T = any> = typeof globalThis extends { onmessage: any } ? {} : CustomEvent<T>;
|
||||
interface CustomEvent<T = any> extends Event {
|
||||
readonly detail: T;
|
||||
}
|
||||
|
||||
interface CustomEventInit<T = any> extends EventInit {
|
||||
detail?: T;
|
||||
}
|
||||
|
||||
type _Event = typeof globalThis extends { onmessage: any } ? {} : Event;
|
||||
interface Event {
|
||||
readonly bubbles: boolean;
|
||||
cancelBubble: boolean;
|
||||
readonly cancelable: boolean;
|
||||
readonly composed: boolean;
|
||||
readonly currentTarget: EventTarget | null;
|
||||
readonly defaultPrevented: boolean;
|
||||
readonly eventPhase: 0 | 2;
|
||||
readonly isTrusted: boolean;
|
||||
returnValue: boolean;
|
||||
readonly srcElement: EventTarget | null;
|
||||
readonly target: EventTarget | null;
|
||||
readonly timeStamp: number;
|
||||
readonly type: string;
|
||||
composedPath(): [EventTarget?];
|
||||
initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void;
|
||||
preventDefault(): void;
|
||||
stopImmediatePropagation(): void;
|
||||
stopPropagation(): void;
|
||||
}
|
||||
|
||||
interface EventInit {
|
||||
bubbles?: boolean;
|
||||
cancelable?: boolean;
|
||||
composed?: boolean;
|
||||
}
|
||||
|
||||
interface EventListener {
|
||||
(evt: Event): void;
|
||||
}
|
||||
|
||||
interface EventListenerObject {
|
||||
handleEvent(object: Event): void;
|
||||
}
|
||||
|
||||
interface EventListenerOptions {
|
||||
capture?: boolean;
|
||||
}
|
||||
|
||||
type _EventTarget = typeof globalThis extends { onmessage: any } ? {} : EventTarget;
|
||||
interface EventTarget {
|
||||
addEventListener(
|
||||
type: string,
|
||||
listener: EventListener | EventListenerObject,
|
||||
options?: AddEventListenerOptions | boolean,
|
||||
): void;
|
||||
dispatchEvent(event: Event): boolean;
|
||||
removeEventListener(
|
||||
type: string,
|
||||
listener: EventListener | EventListenerObject,
|
||||
options?: EventListenerOptions | boolean,
|
||||
): void;
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface CustomEvent<T = any> extends _CustomEvent<T> {}
|
||||
var CustomEvent: typeof globalThis extends { onmessage: any; CustomEvent: infer T } ? T
|
||||
: {
|
||||
prototype: CustomEvent;
|
||||
new<T>(type: string, eventInitDict?: CustomEventInit<T>): CustomEvent<T>;
|
||||
};
|
||||
|
||||
interface Event extends _Event {}
|
||||
var Event: typeof globalThis extends { onmessage: any; Event: infer T } ? T
|
||||
: {
|
||||
prototype: Event;
|
||||
new(type: string, eventInitDict?: EventInit): Event;
|
||||
};
|
||||
|
||||
interface EventTarget extends _EventTarget {}
|
||||
var EventTarget: typeof globalThis extends { onmessage: any; EventTarget: infer T } ? T
|
||||
: {
|
||||
prototype: EventTarget;
|
||||
new(): EventTarget;
|
||||
};
|
||||
}
|
||||
46
@types/node/web-globals/fetch.d.ts
vendored
Normal file
46
@types/node/web-globals/fetch.d.ts
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
export {};
|
||||
|
||||
import * as undici from "undici-types";
|
||||
|
||||
type _EventSource = typeof globalThis extends { onmessage: any } ? {} : undici.EventSource;
|
||||
type _FormData = typeof globalThis extends { onmessage: any } ? {} : undici.FormData;
|
||||
type _Headers = typeof globalThis extends { onmessage: any } ? {} : undici.Headers;
|
||||
type _MessageEvent = typeof globalThis extends { onmessage: any } ? {} : undici.MessageEvent;
|
||||
type _Request = typeof globalThis extends { onmessage: any } ? {} : undici.Request;
|
||||
type _RequestInit = typeof globalThis extends { onmessage: any } ? {} : undici.RequestInit;
|
||||
type _Response = typeof globalThis extends { onmessage: any } ? {} : undici.Response;
|
||||
type _ResponseInit = typeof globalThis extends { onmessage: any } ? {} : undici.ResponseInit;
|
||||
type _WebSocket = typeof globalThis extends { onmessage: any } ? {} : undici.WebSocket;
|
||||
|
||||
declare global {
|
||||
function fetch(
|
||||
input: string | URL | Request,
|
||||
init?: RequestInit,
|
||||
): Promise<Response>;
|
||||
|
||||
interface EventSource extends _EventSource {}
|
||||
var EventSource: typeof globalThis extends { onmessage: any; EventSource: infer T } ? T : typeof undici.EventSource;
|
||||
|
||||
interface FormData extends _FormData {}
|
||||
var FormData: typeof globalThis extends { onmessage: any; FormData: infer T } ? T : typeof undici.FormData;
|
||||
|
||||
interface Headers extends _Headers {}
|
||||
var Headers: typeof globalThis extends { onmessage: any; Headers: infer T } ? T : typeof undici.Headers;
|
||||
|
||||
interface MessageEvent extends _MessageEvent {}
|
||||
var MessageEvent: typeof globalThis extends { onmessage: any; MessageEvent: infer T } ? T
|
||||
: typeof undici.MessageEvent;
|
||||
|
||||
interface Request extends _Request {}
|
||||
var Request: typeof globalThis extends { onmessage: any; Request: infer T } ? T : typeof undici.Request;
|
||||
|
||||
interface RequestInit extends _RequestInit {}
|
||||
|
||||
interface Response extends _Response {}
|
||||
var Response: typeof globalThis extends { onmessage: any; Response: infer T } ? T : typeof undici.Response;
|
||||
|
||||
interface ResponseInit extends _ResponseInit {}
|
||||
|
||||
interface WebSocket extends _WebSocket {}
|
||||
var WebSocket: typeof globalThis extends { onmessage: any; WebSocket: infer T } ? T : typeof undici.WebSocket;
|
||||
}
|
||||
22
@types/node/web-globals/navigator.d.ts
vendored
Normal file
22
@types/node/web-globals/navigator.d.ts
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
export {};
|
||||
|
||||
// lib.webworker has `WorkerNavigator` rather than `Navigator`, so conditionals use `onabort` instead of `onmessage`
|
||||
type _Navigator = typeof globalThis extends { onabort: any } ? {} : Navigator;
|
||||
interface Navigator {
|
||||
readonly hardwareConcurrency: number;
|
||||
readonly language: string;
|
||||
readonly languages: readonly string[];
|
||||
readonly platform: string;
|
||||
readonly userAgent: string;
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Navigator extends _Navigator {}
|
||||
var Navigator: typeof globalThis extends { onabort: any; Navigator: infer T } ? T : {
|
||||
prototype: Navigator;
|
||||
new(): Navigator;
|
||||
};
|
||||
|
||||
// Needs conditional inference for lib.dom and lib.webworker compatibility
|
||||
var navigator: typeof globalThis extends { onmessage: any; navigator: infer T } ? T : Navigator;
|
||||
}
|
||||
24
@types/node/web-globals/storage.d.ts
vendored
Normal file
24
@types/node/web-globals/storage.d.ts
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
export {};
|
||||
|
||||
// These interfaces are absent from lib.webworker, so the conditionals use `onabort` rather than `onmessage`
|
||||
type _Storage = typeof globalThis extends { onabort: any } ? {} : Storage;
|
||||
interface Storage {
|
||||
readonly length: number;
|
||||
clear(): void;
|
||||
getItem(key: string): string | null;
|
||||
key(index: number): string | null;
|
||||
removeItem(key: string): void;
|
||||
setItem(key: string, value: string): void;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Storage extends _Storage {}
|
||||
var Storage: typeof globalThis extends { onabort: any; Storage: infer T } ? T : {
|
||||
prototype: Storage;
|
||||
new(): Storage;
|
||||
};
|
||||
|
||||
var localStorage: Storage;
|
||||
var sessionStorage: Storage;
|
||||
}
|
||||
Reference in New Issue
Block a user