[6a3a178] | 1 | declare module 'util' {
|
---|
| 2 | interface InspectOptions extends NodeJS.InspectOptions { }
|
---|
| 3 | function format(format?: any, ...param: any[]): string;
|
---|
| 4 | function formatWithOptions(inspectOptions: InspectOptions, format?: any, ...param: any[]): string;
|
---|
| 5 | /** @deprecated since v0.11.3 - use a third party module instead. */
|
---|
| 6 | function log(string: string): void;
|
---|
| 7 | function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string;
|
---|
| 8 | function inspect(object: any, options: InspectOptions): string;
|
---|
| 9 | namespace inspect {
|
---|
| 10 | const custom: unique symbol;
|
---|
| 11 | let colors: {
|
---|
| 12 | [color: string]: [number, number] | undefined
|
---|
| 13 | };
|
---|
| 14 | let styles: {
|
---|
| 15 | [style: string]: string | undefined
|
---|
| 16 | };
|
---|
| 17 | let defaultOptions: InspectOptions;
|
---|
| 18 | /**
|
---|
| 19 | * Allows changing inspect settings from the repl.
|
---|
| 20 | */
|
---|
| 21 | let replDefaults: InspectOptions;
|
---|
| 22 | }
|
---|
| 23 | /** @deprecated since v4.0.0 - use `Array.isArray()` instead. */
|
---|
| 24 | function isArray(object: any): object is any[];
|
---|
| 25 | /** @deprecated since v4.0.0 - use `util.types.isRegExp()` instead. */
|
---|
| 26 | function isRegExp(object: any): object is RegExp;
|
---|
| 27 | /** @deprecated since v4.0.0 - use `util.types.isDate()` instead. */
|
---|
| 28 | function isDate(object: any): object is Date;
|
---|
| 29 | /** @deprecated since v4.0.0 - use `util.types.isNativeError()` instead. */
|
---|
| 30 | function isError(object: any): object is Error;
|
---|
| 31 | function inherits(constructor: any, superConstructor: any): void;
|
---|
| 32 | function debuglog(key: string): (msg: string, ...param: any[]) => void;
|
---|
| 33 | /** @deprecated since v4.0.0 - use `typeof value === 'boolean'` instead. */
|
---|
| 34 | function isBoolean(object: any): object is boolean;
|
---|
| 35 | /** @deprecated since v4.0.0 - use `Buffer.isBuffer()` instead. */
|
---|
| 36 | function isBuffer(object: any): object is Buffer;
|
---|
| 37 | /** @deprecated since v4.0.0 - use `typeof value === 'function'` instead. */
|
---|
| 38 | function isFunction(object: any): boolean;
|
---|
| 39 | /** @deprecated since v4.0.0 - use `value === null` instead. */
|
---|
| 40 | function isNull(object: any): object is null;
|
---|
| 41 | /** @deprecated since v4.0.0 - use `value === null || value === undefined` instead. */
|
---|
| 42 | function isNullOrUndefined(object: any): object is null | undefined;
|
---|
| 43 | /** @deprecated since v4.0.0 - use `typeof value === 'number'` instead. */
|
---|
| 44 | function isNumber(object: any): object is number;
|
---|
| 45 | /** @deprecated since v4.0.0 - use `value !== null && typeof value === 'object'` instead. */
|
---|
| 46 | function isObject(object: any): boolean;
|
---|
| 47 | /** @deprecated since v4.0.0 - use `(typeof value !== 'object' && typeof value !== 'function') || value === null` instead. */
|
---|
| 48 | function isPrimitive(object: any): boolean;
|
---|
| 49 | /** @deprecated since v4.0.0 - use `typeof value === 'string'` instead. */
|
---|
| 50 | function isString(object: any): object is string;
|
---|
| 51 | /** @deprecated since v4.0.0 - use `typeof value === 'symbol'` instead. */
|
---|
| 52 | function isSymbol(object: any): object is symbol;
|
---|
| 53 | /** @deprecated since v4.0.0 - use `value === undefined` instead. */
|
---|
| 54 | function isUndefined(object: any): object is undefined;
|
---|
| 55 | function deprecate<T extends Function>(fn: T, message: string, code?: string): T;
|
---|
| 56 | function isDeepStrictEqual(val1: any, val2: any): boolean;
|
---|
| 57 |
|
---|
| 58 | interface CustomPromisify<TCustom extends Function> extends Function {
|
---|
| 59 | __promisify__: TCustom;
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | function callbackify(fn: () => Promise<void>): (callback: (err: NodeJS.ErrnoException) => void) => void;
|
---|
| 63 | function callbackify<TResult>(fn: () => Promise<TResult>): (callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
|
---|
| 64 | function callbackify<T1>(fn: (arg1: T1) => Promise<void>): (arg1: T1, callback: (err: NodeJS.ErrnoException) => void) => void;
|
---|
| 65 | function callbackify<T1, TResult>(fn: (arg1: T1) => Promise<TResult>): (arg1: T1, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
|
---|
| 66 | function callbackify<T1, T2>(fn: (arg1: T1, arg2: T2) => Promise<void>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void;
|
---|
| 67 | function callbackify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2) => Promise<TResult>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
---|
| 68 | function callbackify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void;
|
---|
| 69 | function callbackify<T1, T2, T3, TResult>(
|
---|
| 70 | fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
---|
| 71 | function callbackify<T1, T2, T3, T4>(
|
---|
| 72 | fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void;
|
---|
| 73 | function callbackify<T1, T2, T3, T4, TResult>(
|
---|
| 74 | fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
---|
| 75 | function callbackify<T1, T2, T3, T4, T5>(
|
---|
| 76 | 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: NodeJS.ErrnoException) => void) => void;
|
---|
| 77 | function callbackify<T1, T2, T3, T4, T5, TResult>(
|
---|
| 78 | fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>,
|
---|
| 79 | ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
---|
| 80 | function callbackify<T1, T2, T3, T4, T5, T6>(
|
---|
| 81 | fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<void>,
|
---|
| 82 | ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void;
|
---|
| 83 | function callbackify<T1, T2, T3, T4, T5, T6, TResult>(
|
---|
| 84 | fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<TResult>
|
---|
| 85 | ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
---|
| 86 |
|
---|
| 87 | function promisify<TCustom extends Function>(fn: CustomPromisify<TCustom>): TCustom;
|
---|
| 88 | function promisify<TResult>(fn: (callback: (err: any, result: TResult) => void) => void): () => Promise<TResult>;
|
---|
| 89 | function promisify(fn: (callback: (err?: any) => void) => void): () => Promise<void>;
|
---|
| 90 | function promisify<T1, TResult>(fn: (arg1: T1, callback: (err: any, result: TResult) => void) => void): (arg1: T1) => Promise<TResult>;
|
---|
| 91 | function promisify<T1>(fn: (arg1: T1, callback: (err?: any) => void) => void): (arg1: T1) => Promise<void>;
|
---|
| 92 | function promisify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2, callback: (err: any, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise<TResult>;
|
---|
| 93 | function promisify<T1, T2>(fn: (arg1: T1, arg2: T2, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2) => Promise<void>;
|
---|
| 94 | function promisify<T1, T2, T3, TResult>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: any, result: TResult) => void) => void):
|
---|
| 95 | (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>;
|
---|
| 96 | 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>;
|
---|
| 97 | function promisify<T1, T2, T3, T4, TResult>(
|
---|
| 98 | fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: any, result: TResult) => void) => void,
|
---|
| 99 | ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>;
|
---|
| 100 | function promisify<T1, T2, T3, T4>(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: any) => void) => void):
|
---|
| 101 | (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>;
|
---|
| 102 | function promisify<T1, T2, T3, T4, T5, TResult>(
|
---|
| 103 | fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: any, result: TResult) => void) => void,
|
---|
| 104 | ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>;
|
---|
| 105 | function promisify<T1, T2, T3, T4, T5>(
|
---|
| 106 | fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: any) => void) => void,
|
---|
| 107 | ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>;
|
---|
| 108 | function promisify(fn: Function): Function;
|
---|
| 109 | namespace promisify {
|
---|
| 110 | const custom: unique symbol;
|
---|
| 111 | }
|
---|
| 112 |
|
---|
| 113 | namespace types {
|
---|
| 114 | function isAnyArrayBuffer(object: any): object is ArrayBufferLike;
|
---|
| 115 | function isArgumentsObject(object: any): object is IArguments;
|
---|
| 116 | function isArrayBuffer(object: any): object is ArrayBuffer;
|
---|
| 117 | function isArrayBufferView(object: any): object is NodeJS.ArrayBufferView;
|
---|
| 118 | function isAsyncFunction(object: any): boolean;
|
---|
| 119 | function isBigInt64Array(value: any): value is BigInt64Array;
|
---|
| 120 | function isBigUint64Array(value: any): value is BigUint64Array;
|
---|
| 121 | function isBooleanObject(object: any): object is Boolean;
|
---|
| 122 | function isBoxedPrimitive(object: any): object is String | Number | BigInt | Boolean | Symbol;
|
---|
| 123 | function isDataView(object: any): object is DataView;
|
---|
| 124 | function isDate(object: any): object is Date;
|
---|
| 125 | function isExternal(object: any): boolean;
|
---|
| 126 | function isFloat32Array(object: any): object is Float32Array;
|
---|
| 127 | function isFloat64Array(object: any): object is Float64Array;
|
---|
| 128 | function isGeneratorFunction(object: any): object is GeneratorFunction;
|
---|
| 129 | function isGeneratorObject(object: any): object is Generator;
|
---|
| 130 | function isInt8Array(object: any): object is Int8Array;
|
---|
| 131 | function isInt16Array(object: any): object is Int16Array;
|
---|
| 132 | function isInt32Array(object: any): object is Int32Array;
|
---|
| 133 | function isMap<T>(
|
---|
| 134 | object: T | {},
|
---|
| 135 | ): object is T extends ReadonlyMap<any, any>
|
---|
| 136 | ? unknown extends T
|
---|
| 137 | ? never
|
---|
| 138 | : ReadonlyMap<any, any>
|
---|
| 139 | : Map<any, any>;
|
---|
| 140 | function isMapIterator(object: any): boolean;
|
---|
| 141 | function isModuleNamespaceObject(value: any): boolean;
|
---|
| 142 | function isNativeError(object: any): object is Error;
|
---|
| 143 | function isNumberObject(object: any): object is Number;
|
---|
| 144 | function isPromise(object: any): object is Promise<any>;
|
---|
| 145 | function isProxy(object: any): boolean;
|
---|
| 146 | function isRegExp(object: any): object is RegExp;
|
---|
| 147 | function isSet<T>(
|
---|
| 148 | object: T | {},
|
---|
| 149 | ): object is T extends ReadonlySet<any>
|
---|
| 150 | ? unknown extends T
|
---|
| 151 | ? never
|
---|
| 152 | : ReadonlySet<any>
|
---|
| 153 | : Set<any>;
|
---|
| 154 | function isSetIterator(object: any): boolean;
|
---|
| 155 | function isSharedArrayBuffer(object: any): object is SharedArrayBuffer;
|
---|
| 156 | function isStringObject(object: any): object is String;
|
---|
| 157 | function isSymbolObject(object: any): object is Symbol;
|
---|
| 158 | function isTypedArray(object: any): object is NodeJS.TypedArray;
|
---|
| 159 | function isUint8Array(object: any): object is Uint8Array;
|
---|
| 160 | function isUint8ClampedArray(object: any): object is Uint8ClampedArray;
|
---|
| 161 | function isUint16Array(object: any): object is Uint16Array;
|
---|
| 162 | function isUint32Array(object: any): object is Uint32Array;
|
---|
| 163 | function isWeakMap(object: any): object is WeakMap<any, any>;
|
---|
| 164 | function isWeakSet(object: any): object is WeakSet<any>;
|
---|
| 165 | /** @deprecated Removed in v14.0.0 */
|
---|
| 166 | function isWebAssemblyCompiledModule(object: any): boolean;
|
---|
| 167 | }
|
---|
| 168 |
|
---|
| 169 | class TextDecoder {
|
---|
| 170 | readonly encoding: string;
|
---|
| 171 | readonly fatal: boolean;
|
---|
| 172 | readonly ignoreBOM: boolean;
|
---|
| 173 | constructor(
|
---|
| 174 | encoding?: string,
|
---|
| 175 | options?: { fatal?: boolean | undefined; ignoreBOM?: boolean | undefined }
|
---|
| 176 | );
|
---|
| 177 | decode(
|
---|
| 178 | input?: NodeJS.ArrayBufferView | ArrayBuffer | null,
|
---|
| 179 | options?: { stream?: boolean | undefined }
|
---|
| 180 | ): string;
|
---|
| 181 | }
|
---|
| 182 |
|
---|
| 183 | interface EncodeIntoResult {
|
---|
| 184 | /**
|
---|
| 185 | * The read Unicode code units of input.
|
---|
| 186 | */
|
---|
| 187 |
|
---|
| 188 | read: number;
|
---|
| 189 | /**
|
---|
| 190 | * The written UTF-8 bytes of output.
|
---|
| 191 | */
|
---|
| 192 | written: number;
|
---|
| 193 | }
|
---|
| 194 |
|
---|
| 195 | class TextEncoder {
|
---|
| 196 | readonly encoding: string;
|
---|
| 197 | encode(input?: string): Uint8Array;
|
---|
| 198 | encodeInto(input: string, output: Uint8Array): EncodeIntoResult;
|
---|
| 199 | }
|
---|
| 200 | }
|
---|