mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
Fix gaps in types (#2003)
* Add type for clearImmediate * Expose Crypto class * Add types for CustomEvent * Add types for module and exports * Add types for global * Add types for DOMException * Add types for WebAssembly * Update formatting * Fix clearTimeout * Fix formatting * Update formatting * Remove log --------- Co-authored-by: Colin McDonnell <colinmcd@alum.mit.edu>
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
"build-fallback": "esbuild --target=esnext --bundle src/fallback.ts --format=iife --platform=browser --minify > src/fallback.out.js",
|
||||
"postinstall": "bash .scripts/postinstall.sh",
|
||||
"typecheck": "tsc",
|
||||
"fmt": "prettier --write './**/*.{ts,tsx,js,jsx}'",
|
||||
"fmt": "prettier --write './**/*.{ts,tsx,js,jsx}' --config .prettierrc",
|
||||
"lint": "eslint './**/*.d.ts' --cache",
|
||||
"lint:fix": "eslint './**/*.d.ts' --cache --fix"
|
||||
},
|
||||
|
||||
6
packages/bun-types/.prettierrc
Normal file
6
packages/bun-types/.prettierrc
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"arrowParens": "avoid",
|
||||
"printWidth": 80,
|
||||
"trailingComma": "all",
|
||||
"useTabs": false
|
||||
}
|
||||
12
packages/bun-types/bun.d.ts
vendored
12
packages/bun-types/bun.d.ts
vendored
@@ -2154,16 +2154,16 @@ declare module "bun" {
|
||||
/**
|
||||
* Resolve a `Promise` after milliseconds. This is like
|
||||
* {@link setTimeout} except it returns a `Promise`.
|
||||
*
|
||||
*
|
||||
* @param ms milliseconds to delay resolving the promise. This is a minimum
|
||||
* number. It may take longer. If a {@link Date} is passed, it will sleep until the
|
||||
* {@link Date} is reached.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* @example
|
||||
* ## Sleep for 1 second
|
||||
* ```ts
|
||||
* import { sleep } from "bun";
|
||||
*
|
||||
*
|
||||
* await sleep(1000);
|
||||
* ```
|
||||
* ## Sleep for 10 milliseconds
|
||||
@@ -2171,7 +2171,7 @@ declare module "bun" {
|
||||
* await Bun.sleep(10);
|
||||
* ```
|
||||
* ## Sleep until `Date`
|
||||
*
|
||||
*
|
||||
* ```ts
|
||||
* const target = new Date();
|
||||
* target.setSeconds(target.getSeconds() + 1);
|
||||
@@ -2657,7 +2657,7 @@ declare module "bun" {
|
||||
*/
|
||||
builder: PluginBuilder,
|
||||
): void | Promise<void>;
|
||||
}): ReturnType<(typeof options)["setup"]>;
|
||||
}): ReturnType<typeof options["setup"]>;
|
||||
|
||||
/**
|
||||
* Deactivate all plugins
|
||||
|
||||
Binary file not shown.
25
packages/bun-types/dns.d.ts
vendored
25
packages/bun-types/dns.d.ts
vendored
@@ -331,10 +331,7 @@ declare module "dns" {
|
||||
export function resolve(
|
||||
hostname: string,
|
||||
rrtype: "ANY",
|
||||
callback: (
|
||||
err: ErrnoException | null,
|
||||
addresses: AnyRecord[],
|
||||
) => void,
|
||||
callback: (err: ErrnoException | null, addresses: AnyRecord[]) => void,
|
||||
): void;
|
||||
export function resolve(
|
||||
hostname: string,
|
||||
@@ -344,18 +341,12 @@ declare module "dns" {
|
||||
export function resolve(
|
||||
hostname: string,
|
||||
rrtype: "MX",
|
||||
callback: (
|
||||
err: ErrnoException | null,
|
||||
addresses: MxRecord[],
|
||||
) => void,
|
||||
callback: (err: ErrnoException | null, addresses: MxRecord[]) => void,
|
||||
): void;
|
||||
export function resolve(
|
||||
hostname: string,
|
||||
rrtype: "NAPTR",
|
||||
callback: (
|
||||
err: ErrnoException | null,
|
||||
addresses: NaptrRecord[],
|
||||
) => void,
|
||||
callback: (err: ErrnoException | null, addresses: NaptrRecord[]) => void,
|
||||
): void;
|
||||
export function resolve(
|
||||
hostname: string,
|
||||
@@ -375,18 +366,12 @@ declare module "dns" {
|
||||
export function resolve(
|
||||
hostname: string,
|
||||
rrtype: "SRV",
|
||||
callback: (
|
||||
err: ErrnoException | null,
|
||||
addresses: SrvRecord[],
|
||||
) => void,
|
||||
callback: (err: ErrnoException | null, addresses: SrvRecord[]) => void,
|
||||
): void;
|
||||
export function resolve(
|
||||
hostname: string,
|
||||
rrtype: "TXT",
|
||||
callback: (
|
||||
err: ErrnoException | null,
|
||||
addresses: string[][],
|
||||
) => void,
|
||||
callback: (err: ErrnoException | null, addresses: string[][]) => void,
|
||||
): void;
|
||||
export function resolve(
|
||||
hostname: string,
|
||||
|
||||
421
packages/bun-types/globals.d.ts
vendored
421
packages/bun-types/globals.d.ts
vendored
@@ -14,7 +14,17 @@ type Platform =
|
||||
| "win32"
|
||||
| "cygwin"
|
||||
| "netbsd";
|
||||
type Architecture = "arm" | "arm64" | "ia32" | "mips" | "mipsel" | "ppc" | "ppc64" | "s390" | "s390x" | "x64";
|
||||
type Architecture =
|
||||
| "arm"
|
||||
| "arm64"
|
||||
| "ia32"
|
||||
| "mips"
|
||||
| "mipsel"
|
||||
| "ppc"
|
||||
| "ppc64"
|
||||
| "s390"
|
||||
| "s390x"
|
||||
| "x64";
|
||||
type Signals =
|
||||
| "SIGABRT"
|
||||
| "SIGALRM"
|
||||
@@ -436,7 +446,10 @@ interface Headers {
|
||||
entries(): IterableIterator<[string, string]>;
|
||||
keys(): IterableIterator<string>;
|
||||
values(): IterableIterator<string>;
|
||||
forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any): void;
|
||||
forEach(
|
||||
callbackfn: (value: string, key: string, parent: Headers) => void,
|
||||
thisArg?: any,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Convert {@link Headers} to a plain JavaScript object.
|
||||
@@ -480,7 +493,13 @@ declare var Headers: {
|
||||
};
|
||||
|
||||
type HeadersInit = Array<[string, string]> | Record<string, string> | Headers;
|
||||
type ResponseType = "basic" | "cors" | "default" | "error" | "opaque" | "opaqueredirect";
|
||||
type ResponseType =
|
||||
| "basic"
|
||||
| "cors"
|
||||
| "default"
|
||||
| "error"
|
||||
| "opaque"
|
||||
| "opaqueredirect";
|
||||
|
||||
declare class Blob implements BlobInterface {
|
||||
/**
|
||||
@@ -556,7 +575,10 @@ interface ResponseInit {
|
||||
* ```
|
||||
*/
|
||||
declare class Response implements BlobInterface {
|
||||
constructor(body?: ReadableStream | BlobPart | BlobPart[] | null, options?: ResponseInit);
|
||||
constructor(
|
||||
body?: ReadableStream | BlobPart | BlobPart[] | null,
|
||||
options?: ResponseInit,
|
||||
);
|
||||
|
||||
/**
|
||||
* Create a new {@link Response} with a JSON body
|
||||
@@ -689,7 +711,13 @@ declare class Response implements BlobInterface {
|
||||
clone(): Response;
|
||||
}
|
||||
|
||||
type RequestCache = "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload";
|
||||
type RequestCache =
|
||||
| "default"
|
||||
| "force-cache"
|
||||
| "no-cache"
|
||||
| "no-store"
|
||||
| "only-if-cached"
|
||||
| "reload";
|
||||
type RequestCredentials = "include" | "omit" | "same-origin";
|
||||
type RequestDestination =
|
||||
| ""
|
||||
@@ -729,7 +757,9 @@ type RequestInfo = Request | string;
|
||||
type BodyInit = ReadableStream | XMLHttpRequestBodyInit;
|
||||
type XMLHttpRequestBodyInit = Blob | BufferSource | string;
|
||||
type ReadableStreamController<T> = ReadableStreamDefaultController<T>;
|
||||
type ReadableStreamDefaultReadResult<T> = ReadableStreamDefaultReadValueResult<T> | ReadableStreamDefaultReadDoneResult;
|
||||
type ReadableStreamDefaultReadResult<T> =
|
||||
| ReadableStreamDefaultReadValueResult<T>
|
||||
| ReadableStreamDefaultReadDoneResult;
|
||||
type ReadableStreamReader<T> = ReadableStreamDefaultReader<T>;
|
||||
|
||||
interface RequestInit {
|
||||
@@ -963,7 +993,7 @@ declare class Request implements BlobInterface {
|
||||
clone(): Request;
|
||||
}
|
||||
|
||||
interface Crypto {
|
||||
declare interface Crypto {
|
||||
readonly subtle: SubtleCrypto;
|
||||
|
||||
getRandomValues<T extends BufferSource = BufferSource>(array: T): T;
|
||||
@@ -979,6 +1009,10 @@ interface Crypto {
|
||||
*/
|
||||
randomUUID(): string;
|
||||
}
|
||||
declare var Crypto: {
|
||||
prototype: Crypto;
|
||||
new (): Crypto;
|
||||
};
|
||||
|
||||
declare var crypto: Crypto;
|
||||
|
||||
@@ -1061,7 +1095,10 @@ declare class TextDecoder {
|
||||
*/
|
||||
readonly ignoreBOM: boolean;
|
||||
|
||||
constructor(encoding?: Encoding, options?: { fatal?: boolean; ignoreBOM?: boolean });
|
||||
constructor(
|
||||
encoding?: Encoding,
|
||||
options?: { fatal?: boolean; ignoreBOM?: boolean },
|
||||
);
|
||||
|
||||
/**
|
||||
* Decodes the `input` and returns a string. If `options.stream` is `true`, any
|
||||
@@ -1207,6 +1244,11 @@ declare function clearInterval(id?: number): void;
|
||||
* @param id timer id
|
||||
*/
|
||||
declare function clearTimeout(id?: number): void;
|
||||
/**
|
||||
* Cancel an immediate function call by its immediate ID.
|
||||
* @param id immediate id
|
||||
*/
|
||||
declare function clearImmediate(id?: number): void;
|
||||
// declare function createImageBitmap(image: ImageBitmapSource, options?: ImageBitmapOptions): Promise<ImageBitmap>;
|
||||
// declare function createImageBitmap(image: ImageBitmapSource, sx: number, sy: number, sw: number, sh: number, options?: ImageBitmapOptions): Promise<ImageBitmap>;
|
||||
/**
|
||||
@@ -1220,8 +1262,10 @@ declare function clearTimeout(id?: number): void;
|
||||
*
|
||||
*/
|
||||
|
||||
declare function fetch(url: string | URL, init?: FetchRequestInit): Promise<Response>;
|
||||
|
||||
declare function fetch(
|
||||
url: string | URL,
|
||||
init?: FetchRequestInit,
|
||||
): Promise<Response>;
|
||||
|
||||
/**
|
||||
* Send a HTTP(s) request
|
||||
@@ -1246,19 +1290,30 @@ declare function reportError(error: any): void;
|
||||
* Run a function immediately after main event loop is vacant
|
||||
* @param handler function to call
|
||||
*/
|
||||
declare function setImmediate(handler: TimerHandler, ...arguments: any[]): number;
|
||||
declare function setImmediate(
|
||||
handler: TimerHandler,
|
||||
...arguments: any[]
|
||||
): number;
|
||||
/**
|
||||
* Run a function every `interval` milliseconds
|
||||
* @param handler function to call
|
||||
* @param interval milliseconds to wait between calls
|
||||
*/
|
||||
declare function setInterval(handler: TimerHandler, interval?: number, ...arguments: any[]): number;
|
||||
declare function setInterval(
|
||||
handler: TimerHandler,
|
||||
interval?: number,
|
||||
...arguments: any[]
|
||||
): number;
|
||||
/**
|
||||
* Run a function after `timeout` (milliseconds)
|
||||
* @param handler function to call
|
||||
* @param timeout milliseconds to wait between calls
|
||||
*/
|
||||
declare function setTimeout(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
|
||||
declare function setTimeout(
|
||||
handler: TimerHandler,
|
||||
timeout?: number,
|
||||
...arguments: any[]
|
||||
): number;
|
||||
declare function addEventListener<K extends keyof EventMap>(
|
||||
type: K,
|
||||
listener: (this: object, ev: EventMap[K]) => any,
|
||||
@@ -1572,6 +1627,27 @@ declare var MessageEvent: {
|
||||
new <T>(type: string, eventInitDict?: MessageEventInit<T>): MessageEvent<T>;
|
||||
};
|
||||
|
||||
interface CustomEventInit<T = any> extends EventInit {
|
||||
detail?: T;
|
||||
}
|
||||
|
||||
interface CustomEvent<T = any> extends Event {
|
||||
/** Returns any custom data event was created with. Typically used for synthetic events. */
|
||||
readonly detail: T;
|
||||
/** @deprecated */
|
||||
initCustomEvent(
|
||||
type: string,
|
||||
bubbles?: boolean,
|
||||
cancelable?: boolean,
|
||||
detail?: T,
|
||||
): void;
|
||||
}
|
||||
|
||||
declare var CustomEvent: {
|
||||
prototype: CustomEvent;
|
||||
new <T>(type: string, eventInitDict?: CustomEventInit<T>): CustomEvent<T>;
|
||||
};
|
||||
|
||||
/**
|
||||
* An implementation of the [WebSocket API](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket)
|
||||
*/
|
||||
@@ -1706,14 +1782,19 @@ interface URLSearchParams {
|
||||
keys(): IterableIterator<string>;
|
||||
/** Returns an iterator allowing to go through all values of the key/value pairs of this search parameter. */
|
||||
values(): IterableIterator<string>;
|
||||
forEach(callbackfn: (value: string, key: string, parent: URLSearchParams) => void, thisArg?: any): void;
|
||||
forEach(
|
||||
callbackfn: (value: string, key: string, parent: URLSearchParams) => void,
|
||||
thisArg?: any,
|
||||
): void;
|
||||
/** Returns a string containing a query string suitable for use in a URL. Does not include the question mark. */
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
declare var URLSearchParams: {
|
||||
prototype: URLSearchParams;
|
||||
new (init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
|
||||
new (
|
||||
init?: string[][] | Record<string, string> | string | URLSearchParams,
|
||||
): URLSearchParams;
|
||||
toString(): string;
|
||||
};
|
||||
|
||||
@@ -1914,10 +1995,19 @@ interface ReadableStream<R = any> {
|
||||
readonly locked: boolean;
|
||||
cancel(reason?: any): Promise<void>;
|
||||
getReader(): ReadableStreamDefaultReader<R>;
|
||||
pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;
|
||||
pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;
|
||||
pipeThrough<T>(
|
||||
transform: ReadableWritablePair<T, R>,
|
||||
options?: StreamPipeOptions,
|
||||
): ReadableStream<T>;
|
||||
pipeTo(
|
||||
destination: WritableStream<R>,
|
||||
options?: StreamPipeOptions,
|
||||
): Promise<void>;
|
||||
tee(): [ReadableStream<R>, ReadableStream<R>];
|
||||
forEach(callbackfn: (value: any, key: number, parent: ReadableStream<R>) => void, thisArg?: any): void;
|
||||
forEach(
|
||||
callbackfn: (value: any, key: number, parent: ReadableStream<R>) => void,
|
||||
thisArg?: any,
|
||||
): void;
|
||||
[Symbol.asyncIterator](): AsyncIterableIterator<R>;
|
||||
values(options?: { preventCancel: boolean }): AsyncIterableIterator<R>;
|
||||
}
|
||||
@@ -1975,7 +2065,8 @@ declare var ReadableStreamDefaultController: {
|
||||
new (): ReadableStreamDefaultController;
|
||||
};
|
||||
|
||||
interface ReadableStreamDefaultReader<R = any> extends ReadableStreamGenericReader {
|
||||
interface ReadableStreamDefaultReader<R = any>
|
||||
extends ReadableStreamGenericReader {
|
||||
read(): Promise<ReadableStreamDefaultReadResult<R>>;
|
||||
releaseLock(): void;
|
||||
}
|
||||
@@ -2020,7 +2111,10 @@ interface WritableStream<W = any> {
|
||||
|
||||
declare var WritableStream: {
|
||||
prototype: WritableStream;
|
||||
new <W = any>(underlyingSink?: UnderlyingSink<W>, strategy?: QueuingStrategy<W>): WritableStream<W>;
|
||||
new <W = any>(
|
||||
underlyingSink?: UnderlyingSink<W>,
|
||||
strategy?: QueuingStrategy<W>,
|
||||
): WritableStream<W>;
|
||||
};
|
||||
|
||||
/** This Streams API interface represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate. */
|
||||
@@ -2060,7 +2154,10 @@ interface TransformerStartCallback<O> {
|
||||
}
|
||||
|
||||
interface TransformerTransformCallback<I, O> {
|
||||
(chunk: I, controller: TransformStreamDefaultController<O>): void | PromiseLike<void>;
|
||||
(
|
||||
chunk: I,
|
||||
controller: TransformStreamDefaultController<O>,
|
||||
): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface UnderlyingSinkAbortCallback {
|
||||
@@ -2076,7 +2173,10 @@ interface UnderlyingSinkStartCallback {
|
||||
}
|
||||
|
||||
interface UnderlyingSinkWriteCallback<W> {
|
||||
(chunk: W, controller: WritableStreamDefaultController): void | PromiseLike<void>;
|
||||
(
|
||||
chunk: W,
|
||||
controller: WritableStreamDefaultController,
|
||||
): void | PromiseLike<void>;
|
||||
}
|
||||
|
||||
interface UnderlyingSourceCancelCallback {
|
||||
@@ -2101,7 +2201,9 @@ interface UnderlyingSource<R = any> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
interface DirectUnderlyingSource<R = any> {
|
||||
cancel?: UnderlyingSourceCancelCallback;
|
||||
pull: (controller: ReadableStreamDirectController) => void | PromiseLike<void>;
|
||||
pull: (
|
||||
controller: ReadableStreamDirectController,
|
||||
) => void | PromiseLike<void>;
|
||||
type: "direct";
|
||||
}
|
||||
|
||||
@@ -2206,6 +2308,43 @@ interface ErrnoException extends Error {
|
||||
syscall?: string | undefined;
|
||||
}
|
||||
|
||||
/** An abnormal event (called an exception) which occurs as a result of calling a method or accessing a property of a web API. */
|
||||
interface DOMException extends Error {
|
||||
/** @deprecated */
|
||||
readonly code: number;
|
||||
readonly message: string;
|
||||
readonly name: string;
|
||||
readonly ABORT_ERR: number;
|
||||
readonly DATA_CLONE_ERR: number;
|
||||
readonly DOMSTRING_SIZE_ERR: number;
|
||||
readonly HIERARCHY_REQUEST_ERR: number;
|
||||
readonly INDEX_SIZE_ERR: number;
|
||||
readonly INUSE_ATTRIBUTE_ERR: number;
|
||||
readonly INVALID_ACCESS_ERR: number;
|
||||
readonly INVALID_CHARACTER_ERR: number;
|
||||
readonly INVALID_MODIFICATION_ERR: number;
|
||||
readonly INVALID_NODE_TYPE_ERR: number;
|
||||
readonly INVALID_STATE_ERR: number;
|
||||
readonly NAMESPACE_ERR: number;
|
||||
readonly NETWORK_ERR: number;
|
||||
readonly NOT_FOUND_ERR: number;
|
||||
readonly NOT_SUPPORTED_ERR: number;
|
||||
readonly NO_DATA_ALLOWED_ERR: number;
|
||||
readonly NO_MODIFICATION_ALLOWED_ERR: number;
|
||||
readonly QUOTA_EXCEEDED_ERR: number;
|
||||
readonly SECURITY_ERR: number;
|
||||
readonly SYNTAX_ERR: number;
|
||||
readonly TIMEOUT_ERR: number;
|
||||
readonly TYPE_MISMATCH_ERR: number;
|
||||
readonly URL_MISMATCH_ERR: number;
|
||||
readonly VALIDATION_ERR: number;
|
||||
readonly WRONG_DOCUMENT_ERR: number;
|
||||
}
|
||||
declare var DOMException: {
|
||||
prototype: DOMException;
|
||||
new (message?: string, name?: string): DOMException;
|
||||
};
|
||||
|
||||
declare function alert(message?: string): void;
|
||||
declare function confirm(message?: string): boolean;
|
||||
declare function prompt(message?: string, _default?: string): string | null;
|
||||
@@ -2218,7 +2357,15 @@ declare function prompt(message?: string, _default?: string): string | null;
|
||||
|
||||
type KeyFormat = "jwk" | "pkcs8" | "raw" | "spki";
|
||||
type KeyType = "private" | "public" | "secret";
|
||||
type KeyUsage = "decrypt" | "deriveBits" | "deriveKey" | "encrypt" | "sign" | "unwrapKey" | "verify" | "wrapKey";
|
||||
type KeyUsage =
|
||||
| "decrypt"
|
||||
| "deriveBits"
|
||||
| "deriveKey"
|
||||
| "encrypt"
|
||||
| "sign"
|
||||
| "unwrapKey"
|
||||
| "verify"
|
||||
| "wrapKey";
|
||||
type HashAlgorithmIdentifier = AlgorithmIdentifier;
|
||||
type NamedCurve = string;
|
||||
|
||||
@@ -2371,30 +2518,59 @@ type AlgorithmIdentifier = Algorithm | string;
|
||||
*/
|
||||
interface SubtleCrypto {
|
||||
decrypt(
|
||||
algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,
|
||||
algorithm:
|
||||
| AlgorithmIdentifier
|
||||
| RsaOaepParams
|
||||
| AesCtrParams
|
||||
| AesCbcParams
|
||||
| AesGcmParams,
|
||||
key: CryptoKey,
|
||||
data: BufferSource,
|
||||
): Promise<ArrayBuffer>;
|
||||
deriveBits(
|
||||
algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params,
|
||||
algorithm:
|
||||
| AlgorithmIdentifier
|
||||
| EcdhKeyDeriveParams
|
||||
| HkdfParams
|
||||
| Pbkdf2Params,
|
||||
baseKey: CryptoKey,
|
||||
length: number,
|
||||
): Promise<ArrayBuffer>;
|
||||
deriveKey(
|
||||
algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params,
|
||||
algorithm:
|
||||
| AlgorithmIdentifier
|
||||
| EcdhKeyDeriveParams
|
||||
| HkdfParams
|
||||
| Pbkdf2Params,
|
||||
baseKey: CryptoKey,
|
||||
derivedKeyType: AlgorithmIdentifier | AesDerivedKeyParams | HmacImportParams | HkdfParams | Pbkdf2Params,
|
||||
derivedKeyType:
|
||||
| AlgorithmIdentifier
|
||||
| AesDerivedKeyParams
|
||||
| HmacImportParams
|
||||
| HkdfParams
|
||||
| Pbkdf2Params,
|
||||
extractable: boolean,
|
||||
keyUsages: KeyUsage[],
|
||||
): Promise<CryptoKey>;
|
||||
digest(algorithm: AlgorithmIdentifier, data: BufferSource): Promise<ArrayBuffer>;
|
||||
digest(
|
||||
algorithm: AlgorithmIdentifier,
|
||||
data: BufferSource,
|
||||
): Promise<ArrayBuffer>;
|
||||
encrypt(
|
||||
algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,
|
||||
algorithm:
|
||||
| AlgorithmIdentifier
|
||||
| RsaOaepParams
|
||||
| AesCtrParams
|
||||
| AesCbcParams
|
||||
| AesGcmParams,
|
||||
key: CryptoKey,
|
||||
data: BufferSource,
|
||||
): Promise<ArrayBuffer>;
|
||||
exportKey(format: "jwk", key: CryptoKey): Promise<JsonWebKey>;
|
||||
exportKey(format: Exclude<KeyFormat, "jwk">, key: CryptoKey): Promise<ArrayBuffer>;
|
||||
exportKey(
|
||||
format: Exclude<KeyFormat, "jwk">,
|
||||
key: CryptoKey,
|
||||
): Promise<ArrayBuffer>;
|
||||
generateKey(
|
||||
algorithm: RsaHashedKeyGenParams | EcKeyGenParams,
|
||||
extractable: boolean,
|
||||
@@ -2413,14 +2589,24 @@ interface SubtleCrypto {
|
||||
importKey(
|
||||
format: "jwk",
|
||||
keyData: JsonWebKey,
|
||||
algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm,
|
||||
algorithm:
|
||||
| AlgorithmIdentifier
|
||||
| RsaHashedImportParams
|
||||
| EcKeyImportParams
|
||||
| HmacImportParams
|
||||
| AesKeyAlgorithm,
|
||||
extractable: boolean,
|
||||
keyUsages: ReadonlyArray<KeyUsage>,
|
||||
): Promise<CryptoKey>;
|
||||
importKey(
|
||||
format: Exclude<KeyFormat, "jwk">,
|
||||
keyData: BufferSource,
|
||||
algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm,
|
||||
algorithm:
|
||||
| AlgorithmIdentifier
|
||||
| RsaHashedImportParams
|
||||
| EcKeyImportParams
|
||||
| HmacImportParams
|
||||
| AesKeyAlgorithm,
|
||||
extractable: boolean,
|
||||
keyUsages: KeyUsage[],
|
||||
): Promise<CryptoKey>;
|
||||
@@ -2433,7 +2619,12 @@ interface SubtleCrypto {
|
||||
format: KeyFormat,
|
||||
wrappedKey: BufferSource,
|
||||
unwrappingKey: CryptoKey,
|
||||
unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,
|
||||
unwrapAlgorithm:
|
||||
| AlgorithmIdentifier
|
||||
| RsaOaepParams
|
||||
| AesCtrParams
|
||||
| AesCbcParams
|
||||
| AesGcmParams,
|
||||
unwrappedKeyAlgorithm:
|
||||
| AlgorithmIdentifier
|
||||
| RsaHashedImportParams
|
||||
@@ -2453,7 +2644,12 @@ interface SubtleCrypto {
|
||||
format: KeyFormat,
|
||||
key: CryptoKey,
|
||||
wrappingKey: CryptoKey,
|
||||
wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,
|
||||
wrapAlgorithm:
|
||||
| AlgorithmIdentifier
|
||||
| RsaOaepParams
|
||||
| AesCtrParams
|
||||
| AesCbcParams
|
||||
| AesGcmParams,
|
||||
): Promise<ArrayBuffer>;
|
||||
}
|
||||
|
||||
@@ -2537,7 +2733,9 @@ interface ErrorConstructor {
|
||||
*
|
||||
* @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
||||
*/
|
||||
prepareStackTrace?: ((err: Error, stackTraces: CallSite[]) => any) | undefined;
|
||||
prepareStackTrace?:
|
||||
| ((err: Error, stackTraces: CallSite[]) => any)
|
||||
| undefined;
|
||||
|
||||
stackTraceLimit: number;
|
||||
}
|
||||
@@ -2642,3 +2840,154 @@ interface SharedArrayBuffer {
|
||||
*/
|
||||
grow(size: number): SharedArrayBuffer;
|
||||
}
|
||||
|
||||
declare namespace WebAssembly {
|
||||
interface CompileError extends Error {}
|
||||
|
||||
var CompileError: {
|
||||
prototype: CompileError;
|
||||
new (message?: string): CompileError;
|
||||
(message?: string): CompileError;
|
||||
};
|
||||
|
||||
interface Global {
|
||||
value: any;
|
||||
valueOf(): any;
|
||||
}
|
||||
|
||||
var Global: {
|
||||
prototype: Global;
|
||||
new (descriptor: GlobalDescriptor, v?: any): Global;
|
||||
};
|
||||
|
||||
interface Instance {
|
||||
readonly exports: Exports;
|
||||
}
|
||||
|
||||
var Instance: {
|
||||
prototype: Instance;
|
||||
new (module: Module, importObject?: Imports): Instance;
|
||||
};
|
||||
|
||||
interface LinkError extends Error {}
|
||||
|
||||
var LinkError: {
|
||||
prototype: LinkError;
|
||||
new (message?: string): LinkError;
|
||||
(message?: string): LinkError;
|
||||
};
|
||||
|
||||
interface Memory {
|
||||
readonly buffer: ArrayBuffer;
|
||||
grow(delta: number): number;
|
||||
}
|
||||
|
||||
var Memory: {
|
||||
prototype: Memory;
|
||||
new (descriptor: MemoryDescriptor): Memory;
|
||||
};
|
||||
|
||||
interface Module {}
|
||||
|
||||
var Module: {
|
||||
prototype: Module;
|
||||
new (bytes: BufferSource): Module;
|
||||
customSections(moduleObject: Module, sectionName: string): ArrayBuffer[];
|
||||
exports(moduleObject: Module): ModuleExportDescriptor[];
|
||||
imports(moduleObject: Module): ModuleImportDescriptor[];
|
||||
};
|
||||
|
||||
interface RuntimeError extends Error {}
|
||||
|
||||
var RuntimeError: {
|
||||
prototype: RuntimeError;
|
||||
new (message?: string): RuntimeError;
|
||||
(message?: string): RuntimeError;
|
||||
};
|
||||
|
||||
interface Table {
|
||||
readonly length: number;
|
||||
get(index: number): any;
|
||||
grow(delta: number, value?: any): number;
|
||||
set(index: number, value?: any): void;
|
||||
}
|
||||
|
||||
var Table: {
|
||||
prototype: Table;
|
||||
new (descriptor: TableDescriptor, value?: any): Table;
|
||||
};
|
||||
|
||||
interface GlobalDescriptor {
|
||||
mutable?: boolean;
|
||||
value: ValueType;
|
||||
}
|
||||
|
||||
interface MemoryDescriptor {
|
||||
initial: number;
|
||||
maximum?: number;
|
||||
shared?: boolean;
|
||||
}
|
||||
|
||||
interface ModuleExportDescriptor {
|
||||
kind: ImportExportKind;
|
||||
name: string;
|
||||
}
|
||||
|
||||
interface ModuleImportDescriptor {
|
||||
kind: ImportExportKind;
|
||||
module: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
interface TableDescriptor {
|
||||
element: TableKind;
|
||||
initial: number;
|
||||
maximum?: number;
|
||||
}
|
||||
|
||||
interface WebAssemblyInstantiatedSource {
|
||||
instance: Instance;
|
||||
module: Module;
|
||||
}
|
||||
|
||||
type ImportExportKind = "function" | "global" | "memory" | "table";
|
||||
type TableKind = "anyfunc" | "externref";
|
||||
type ValueType =
|
||||
| "anyfunc"
|
||||
| "externref"
|
||||
| "f32"
|
||||
| "f64"
|
||||
| "i32"
|
||||
| "i64"
|
||||
| "v128";
|
||||
type ExportValue = Function | Global | Memory | Table;
|
||||
type Exports = Record<string, ExportValue>;
|
||||
type ImportValue = ExportValue | number;
|
||||
type Imports = Record<string, ModuleImports>;
|
||||
type ModuleImports = Record<string, ImportValue>;
|
||||
function compile(bytes: BufferSource): Promise<Module>;
|
||||
// function compileStreaming(source: Response | PromiseLike<Response>): Promise<Module>;
|
||||
function instantiate(
|
||||
bytes: BufferSource,
|
||||
importObject?: Imports,
|
||||
): Promise<WebAssemblyInstantiatedSource>;
|
||||
function instantiate(
|
||||
moduleObject: Module,
|
||||
importObject?: Imports,
|
||||
): Promise<Instance>;
|
||||
// function instantiateStreaming(
|
||||
// source: Response | PromiseLike<Response>,
|
||||
// importObject?: Imports,
|
||||
// ): Promise<WebAssemblyInstantiatedSource>;
|
||||
function validate(bytes: BufferSource): boolean;
|
||||
}
|
||||
|
||||
interface NodeModule {
|
||||
exports: any;
|
||||
}
|
||||
|
||||
declare var module: NodeModule;
|
||||
|
||||
// Same as module.exports
|
||||
declare var exports: any;
|
||||
declare var global: typeof globalThis;
|
||||
|
||||
@@ -23,7 +23,7 @@ try {
|
||||
|
||||
const header = await file(join(import.meta.dir, "..", "header.txt")).text();
|
||||
const filesToCat = (await getDotTsFiles("./")).filter(
|
||||
(f) => !["./index.d.ts"].some((tf) => f === tf),
|
||||
f => !["./index.d.ts"].some(tf => f === tf),
|
||||
);
|
||||
|
||||
const fileContents: string[] = [];
|
||||
|
||||
@@ -12,9 +12,11 @@ expectType<"WHATEVER">(process.env.WHATEVER);
|
||||
|
||||
export {};
|
||||
new Bun.Transpiler({
|
||||
macros: {
|
||||
macro: {
|
||||
"react-relay": {
|
||||
graphql: "bun-macro-relay/bun-macro-relay.tsx",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Event;
|
||||
|
||||
@@ -64,3 +64,26 @@ expectType<Promise<void>>(fsPromises.mkdir("./index.d.ts"));
|
||||
Bun.env;
|
||||
|
||||
Bun.version;
|
||||
|
||||
setImmediate;
|
||||
clearImmediate;
|
||||
setInterval;
|
||||
clearInterval;
|
||||
setTimeout;
|
||||
clearTimeout;
|
||||
|
||||
const arg = new AbortSignal();
|
||||
arg;
|
||||
|
||||
const e = new CustomEvent("asdf");
|
||||
console.log(e);
|
||||
|
||||
exports;
|
||||
module.exports;
|
||||
|
||||
global.AbortController;
|
||||
global.Bun;
|
||||
|
||||
const er = new DOMException();
|
||||
er.name;
|
||||
er.HIERARCHY_REQUEST_ERR;
|
||||
|
||||
12
packages/bun-types/timers.d.ts
vendored
12
packages/bun-types/timers.d.ts
vendored
@@ -19,8 +19,16 @@ declare module "timers" {
|
||||
const _exported: {
|
||||
clearTimeout: (timer: Timer | number) => void;
|
||||
clearInterval: (timer: Timer | number) => void;
|
||||
setInterval: (cb: CallableFunction, msDelay: number, ...args: any[]) => Timer;
|
||||
setTimeout: (cb: CallableFunction, msDelay: number, ...args: any[]) => Timer;
|
||||
setInterval: (
|
||||
cb: CallableFunction,
|
||||
msDelay: number,
|
||||
...args: any[]
|
||||
) => Timer;
|
||||
setTimeout: (
|
||||
cb: CallableFunction,
|
||||
msDelay: number,
|
||||
...args: any[]
|
||||
) => Timer;
|
||||
setImmediate: (cb: CallableFunction, ...args: any[]) => Timer;
|
||||
};
|
||||
export = _exported;
|
||||
|
||||
189
packages/bun-types/util.d.ts
vendored
189
packages/bun-types/util.d.ts
vendored
@@ -64,7 +64,10 @@ declare module "util" {
|
||||
| "date"
|
||||
| "regexp"
|
||||
| "module";
|
||||
export type CustomInspectFunction = (depth: number, options: InspectOptionsStylized) => string;
|
||||
export type CustomInspectFunction = (
|
||||
depth: number,
|
||||
options: InspectOptionsStylized,
|
||||
) => string;
|
||||
export interface InspectOptionsStylized extends InspectOptions {
|
||||
stylize(text: string, styleType: Style): string;
|
||||
}
|
||||
@@ -341,7 +344,12 @@ declare module "util" {
|
||||
* @param object Any JavaScript primitive or `Object`.
|
||||
* @return The representation of `object`.
|
||||
*/
|
||||
export function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string;
|
||||
export function inspect(
|
||||
object: any,
|
||||
showHidden?: boolean,
|
||||
depth?: number | null,
|
||||
color?: boolean,
|
||||
): string;
|
||||
export function inspect(object: any, options?: InspectOptions): string;
|
||||
export namespace inspect {
|
||||
let colors: Dict<[number, number]>;
|
||||
@@ -494,7 +502,10 @@ declare module "util" {
|
||||
* ```
|
||||
* @deprecated Legacy: Use ES2015 class syntax and `extends` keyword instead.
|
||||
*/
|
||||
export function inherits(constructor: unknown, superConstructor: unknown): void;
|
||||
export function inherits(
|
||||
constructor: unknown,
|
||||
superConstructor: unknown,
|
||||
): void;
|
||||
export type DebugLoggerFunction = (msg: string, ...param: unknown[]) => void;
|
||||
export interface DebugLogger extends DebugLoggerFunction {
|
||||
enabled: boolean;
|
||||
@@ -555,7 +566,10 @@ declare module "util" {
|
||||
* @param callback A callback invoked the first time the logging function is called with a function argument that is a more optimized logging function.
|
||||
* @return The logging function
|
||||
*/
|
||||
export function debuglog(section: string, callback?: (fn: DebugLoggerFunction) => void): DebugLogger;
|
||||
export function debuglog(
|
||||
section: string,
|
||||
callback?: (fn: DebugLoggerFunction) => void,
|
||||
): DebugLogger;
|
||||
export const debug: typeof debuglog;
|
||||
/**
|
||||
* Returns `true` if the given `object` is a `Boolean`. Otherwise, returns `false`.
|
||||
@@ -640,7 +654,9 @@ declare module "util" {
|
||||
* ```
|
||||
* @deprecated Since v4.0.0 - Use `value === undefined || value === null` instead.
|
||||
*/
|
||||
export function isNullOrUndefined(object: unknown): object is null | undefined;
|
||||
export function isNullOrUndefined(
|
||||
object: unknown,
|
||||
): object is null | undefined;
|
||||
/**
|
||||
* Returns `true` if the given `object` is a `Number`. Otherwise, returns `false`.
|
||||
*
|
||||
@@ -804,7 +820,11 @@ declare module "util" {
|
||||
* @param code A deprecation code. See the `list of deprecated APIs` for a list of codes.
|
||||
* @return The deprecated function wrapped to emit a warning.
|
||||
*/
|
||||
export function deprecate<T extends Function>(fn: T, msg: string, code?: string): T;
|
||||
export function deprecate<T extends Function>(
|
||||
fn: T,
|
||||
msg: string,
|
||||
code?: string,
|
||||
): T;
|
||||
/**
|
||||
* Returns `true` if there is deep strict equality between `val1` and `val2`.
|
||||
* Otherwise, returns `false`.
|
||||
@@ -871,7 +891,9 @@ declare module "util" {
|
||||
* @param original An `async` function
|
||||
* @return a callback style function
|
||||
*/
|
||||
export function callbackify(fn: () => Promise<void>): (callback: (err: ErrnoException) => void) => void;
|
||||
export function callbackify(
|
||||
fn: () => Promise<void>,
|
||||
): (callback: (err: ErrnoException) => void) => void;
|
||||
export function callbackify<TResult>(
|
||||
fn: () => Promise<TResult>,
|
||||
): (callback: (err: ErrnoException, result: TResult) => void) => void;
|
||||
@@ -880,28 +902,64 @@ declare module "util" {
|
||||
): (arg1: T1, callback: (err: ErrnoException) => void) => void;
|
||||
export function callbackify<T1, TResult>(
|
||||
fn: (arg1: T1) => Promise<TResult>,
|
||||
): (arg1: T1, callback: (err: ErrnoException, result: TResult) => void) => void;
|
||||
): (
|
||||
arg1: T1,
|
||||
callback: (err: ErrnoException, result: TResult) => void,
|
||||
) => void;
|
||||
export function callbackify<T1, T2>(
|
||||
fn: (arg1: T1, arg2: T2) => Promise<void>,
|
||||
): (arg1: T1, arg2: T2, callback: (err: ErrnoException) => void) => void;
|
||||
export function callbackify<T1, T2, TResult>(
|
||||
fn: (arg1: T1, arg2: T2) => Promise<TResult>,
|
||||
): (arg1: T1, arg2: T2, callback: (err: ErrnoException | null, result: TResult) => void) => void;
|
||||
): (
|
||||
arg1: T1,
|
||||
arg2: T2,
|
||||
callback: (err: ErrnoException | null, result: TResult) => void,
|
||||
) => void;
|
||||
export function callbackify<T1, T2, T3>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<void>,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, callback: (err: ErrnoException) => void) => void;
|
||||
): (
|
||||
arg1: T1,
|
||||
arg2: T2,
|
||||
arg3: T3,
|
||||
callback: (err: ErrnoException) => void,
|
||||
) => void;
|
||||
export function callbackify<T1, T2, T3, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, callback: (err: ErrnoException | null, result: TResult) => void) => void;
|
||||
): (
|
||||
arg1: T1,
|
||||
arg2: T2,
|
||||
arg3: T3,
|
||||
callback: (err: ErrnoException | null, result: TResult) => void,
|
||||
) => void;
|
||||
export function callbackify<T1, T2, T3, T4>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: ErrnoException) => void) => void;
|
||||
): (
|
||||
arg1: T1,
|
||||
arg2: T2,
|
||||
arg3: T3,
|
||||
arg4: T4,
|
||||
callback: (err: ErrnoException) => void,
|
||||
) => void;
|
||||
export function callbackify<T1, T2, T3, T4, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: ErrnoException | null, result: TResult) => void) => void;
|
||||
): (
|
||||
arg1: T1,
|
||||
arg2: T2,
|
||||
arg3: T3,
|
||||
arg4: T4,
|
||||
callback: (err: ErrnoException | null, result: TResult) => void,
|
||||
) => void;
|
||||
export function callbackify<T1, T2, T3, T4, T5>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: ErrnoException) => void) => void;
|
||||
): (
|
||||
arg1: T1,
|
||||
arg2: T2,
|
||||
arg3: T3,
|
||||
arg4: T4,
|
||||
arg5: T5,
|
||||
callback: (err: ErrnoException) => void,
|
||||
) => void;
|
||||
export function callbackify<T1, T2, T3, T4, T5, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>,
|
||||
): (
|
||||
@@ -913,10 +971,32 @@ declare module "util" {
|
||||
callback: (err: ErrnoException | null, result: TResult) => void,
|
||||
) => void;
|
||||
export function callbackify<T1, T2, T3, T4, T5, T6>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<void>,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: ErrnoException) => void) => void;
|
||||
fn: (
|
||||
arg1: T1,
|
||||
arg2: T2,
|
||||
arg3: T3,
|
||||
arg4: T4,
|
||||
arg5: T5,
|
||||
arg6: T6,
|
||||
) => Promise<void>,
|
||||
): (
|
||||
arg1: T1,
|
||||
arg2: T2,
|
||||
arg3: T3,
|
||||
arg4: T4,
|
||||
arg5: T5,
|
||||
arg6: T6,
|
||||
callback: (err: ErrnoException) => void,
|
||||
) => void;
|
||||
export function callbackify<T1, T2, T3, T4, T5, T6, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<TResult>,
|
||||
fn: (
|
||||
arg1: T1,
|
||||
arg2: T2,
|
||||
arg3: T3,
|
||||
arg4: T4,
|
||||
arg5: T5,
|
||||
arg6: T6,
|
||||
) => Promise<TResult>,
|
||||
): (
|
||||
arg1: T1,
|
||||
arg2: T2,
|
||||
@@ -926,10 +1006,12 @@ declare module "util" {
|
||||
arg6: T6,
|
||||
callback: (err: ErrnoException | null, result: TResult) => void,
|
||||
) => void;
|
||||
export interface CustomPromisifyLegacy<TCustom extends Function> extends Function {
|
||||
export interface CustomPromisifyLegacy<TCustom extends Function>
|
||||
extends Function {
|
||||
__promisify__: TCustom;
|
||||
}
|
||||
export interface CustomPromisifySymbol<TCustom extends Function> extends Function {
|
||||
export interface CustomPromisifySymbol<TCustom extends Function>
|
||||
extends Function {
|
||||
[promisify.custom]: TCustom;
|
||||
}
|
||||
export type CustomPromisify<TCustom extends Function> =
|
||||
@@ -1001,38 +1083,79 @@ declare module "util" {
|
||||
* bindBar().then((a) => console.log(a)); // '42'
|
||||
* ```
|
||||
*/
|
||||
export function promisify<TCustom extends Function>(fn: CustomPromisify<TCustom>): TCustom;
|
||||
export function promisify<TCustom extends Function>(
|
||||
fn: CustomPromisify<TCustom>,
|
||||
): TCustom;
|
||||
export function promisify<TResult>(
|
||||
fn: (callback: (err: any, result: TResult) => void) => void,
|
||||
): () => Promise<TResult>;
|
||||
export function promisify(fn: (callback: (err?: any) => void) => void): () => Promise<void>;
|
||||
export function promisify(
|
||||
fn: (callback: (err?: any) => void) => void,
|
||||
): () => Promise<void>;
|
||||
export function promisify<T1, TResult>(
|
||||
fn: (arg1: T1, callback: (err: any, result: TResult) => void) => void,
|
||||
): (arg1: T1) => Promise<TResult>;
|
||||
export function promisify<T1>(fn: (arg1: T1, callback: (err?: any) => void) => void): (arg1: T1) => Promise<void>;
|
||||
export function promisify<T1>(
|
||||
fn: (arg1: T1, callback: (err?: any) => void) => void,
|
||||
): (arg1: T1) => Promise<void>;
|
||||
export function promisify<T1, T2, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, callback: (err: any, result: TResult) => void) => void,
|
||||
fn: (
|
||||
arg1: T1,
|
||||
arg2: T2,
|
||||
callback: (err: any, result: TResult) => void,
|
||||
) => void,
|
||||
): (arg1: T1, arg2: T2) => Promise<TResult>;
|
||||
export function promisify<T1, T2>(
|
||||
fn: (arg1: T1, arg2: T2, callback: (err?: any) => void) => void,
|
||||
): (arg1: T1, arg2: T2) => Promise<void>;
|
||||
export function promisify<T1, T2, T3, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: any, result: TResult) => void) => void,
|
||||
fn: (
|
||||
arg1: T1,
|
||||
arg2: T2,
|
||||
arg3: T3,
|
||||
callback: (err: any, result: TResult) => void,
|
||||
) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>;
|
||||
export function promisify<T1, T2, T3>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: any) => void) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3) => Promise<void>;
|
||||
export function promisify<T1, T2, T3, T4, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: any, result: TResult) => void) => void,
|
||||
fn: (
|
||||
arg1: T1,
|
||||
arg2: T2,
|
||||
arg3: T3,
|
||||
arg4: T4,
|
||||
callback: (err: any, result: TResult) => void,
|
||||
) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>;
|
||||
export function promisify<T1, T2, T3, T4>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: any) => void) => void,
|
||||
fn: (
|
||||
arg1: T1,
|
||||
arg2: T2,
|
||||
arg3: T3,
|
||||
arg4: T4,
|
||||
callback: (err?: any) => void,
|
||||
) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>;
|
||||
export function promisify<T1, T2, T3, T4, T5, TResult>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: any, result: TResult) => void) => void,
|
||||
fn: (
|
||||
arg1: T1,
|
||||
arg2: T2,
|
||||
arg3: T3,
|
||||
arg4: T4,
|
||||
arg5: T5,
|
||||
callback: (err: any, result: TResult) => void,
|
||||
) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>;
|
||||
export function promisify<T1, T2, T3, T4, T5>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: any) => void) => void,
|
||||
fn: (
|
||||
arg1: T1,
|
||||
arg2: T2,
|
||||
arg3: T3,
|
||||
arg4: T4,
|
||||
arg5: T5,
|
||||
callback: (err?: any) => void,
|
||||
) => void,
|
||||
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>;
|
||||
export function promisify(fn: Function): Function;
|
||||
export namespace promisify {
|
||||
@@ -1182,7 +1305,9 @@ declare module "util/types" {
|
||||
* ```
|
||||
* @since v10.11.0
|
||||
*/
|
||||
function isBoxedPrimitive(object: unknown): object is String | Number | BigInt | Boolean | Symbol;
|
||||
function isBoxedPrimitive(
|
||||
object: unknown,
|
||||
): object is String | Number | BigInt | Boolean | Symbol;
|
||||
/**
|
||||
* Returns `true` if the value is a built-in [`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) instance.
|
||||
*
|
||||
@@ -1428,7 +1553,11 @@ declare module "util/types" {
|
||||
*/
|
||||
function isSet<T>(
|
||||
object: T | {},
|
||||
): object is T extends ReadonlySet<any> ? (unknown extends T ? never : ReadonlySet<any>) : Set<unknown>;
|
||||
): object is T extends ReadonlySet<any>
|
||||
? unknown extends T
|
||||
? never
|
||||
: ReadonlySet<any>
|
||||
: Set<unknown>;
|
||||
/**
|
||||
* Returns `true` if the value is an iterator returned for a built-in [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) instance.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user