@types/node 20.6.3 → 20.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- node/README.md +1 -1
- node/assert/strict.d.ts +4 -4
- node/assert.d.ts +48 -24
- node/async_hooks.d.ts +13 -6
- node/buffer.d.ts +32 -34
- node/child_process.d.ts +262 -122
- node/cluster.d.ts +107 -89
- node/console.d.ts +7 -7
- node/constants.d.ts +12 -11
- node/crypto.d.ts +746 -268
- node/dgram.d.ts +81 -45
- node/diagnostics_channel.d.ts +3 -3
- node/dns/promises.d.ts +28 -25
- node/dns.d.ts +203 -62
- node/dom-events.d.ts +67 -71
- node/domain.d.ts +4 -4
- node/events.d.ts +15 -7
- node/fs/promises.d.ts +102 -73
- node/fs.d.ts +513 -311
- node/globals.d.ts +18 -20
- node/http.d.ts +238 -186
- node/http2.d.ts +628 -376
- node/https.d.ts +221 -112
- node/module.d.ts +16 -9
- node/net.d.ts +112 -93
- node/os.d.ts +7 -7
- node/package.json +2 -2
- node/path.d.ts +13 -13
- node/perf_hooks.d.ts +19 -18
- node/process.d.ts +155 -125
- node/punycode.d.ts +3 -3
- node/querystring.d.ts +14 -4
- node/readline/promises.d.ts +12 -7
- node/readline.d.ts +69 -56
- node/repl.d.ts +67 -61
- node/stream/consumers.d.ts +5 -5
- node/stream/promises.d.ts +56 -15
- node/stream/web.d.ts +26 -20
- node/stream.d.ts +361 -228
- node/string_decoder.d.ts +3 -3
- node/test.d.ts +78 -93
- node/timers/promises.d.ts +4 -4
- node/timers.d.ts +23 -8
- node/tls.d.ts +151 -71
- node/trace_events.d.ts +3 -3
- node/ts4.8/assert/strict.d.ts +4 -4
- node/ts4.8/assert.d.ts +48 -24
- node/ts4.8/async_hooks.d.ts +13 -6
- node/ts4.8/buffer.d.ts +32 -34
- node/ts4.8/child_process.d.ts +262 -122
- node/ts4.8/cluster.d.ts +107 -89
- node/ts4.8/console.d.ts +7 -7
- node/ts4.8/constants.d.ts +12 -11
- node/ts4.8/crypto.d.ts +746 -268
- node/ts4.8/dgram.d.ts +81 -45
- node/ts4.8/diagnostics_channel.d.ts +3 -3
- node/ts4.8/dns/promises.d.ts +28 -25
- node/ts4.8/dns.d.ts +203 -62
- node/ts4.8/dom-events.d.ts +67 -71
- node/ts4.8/domain.d.ts +4 -4
- node/ts4.8/events.d.ts +15 -7
- node/ts4.8/fs/promises.d.ts +102 -73
- node/ts4.8/fs.d.ts +513 -311
- node/ts4.8/globals.d.ts +18 -20
- node/ts4.8/http.d.ts +238 -186
- node/ts4.8/http2.d.ts +628 -376
- node/ts4.8/https.d.ts +221 -112
- node/ts4.8/module.d.ts +16 -9
- node/ts4.8/net.d.ts +112 -93
- node/ts4.8/os.d.ts +7 -7
- node/ts4.8/path.d.ts +13 -13
- node/ts4.8/perf_hooks.d.ts +19 -18
- node/ts4.8/process.d.ts +155 -125
- node/ts4.8/punycode.d.ts +3 -3
- node/ts4.8/querystring.d.ts +14 -4
- node/ts4.8/readline/promises.d.ts +12 -7
- node/ts4.8/readline.d.ts +69 -56
- node/ts4.8/repl.d.ts +67 -61
- node/ts4.8/stream/consumers.d.ts +5 -5
- node/ts4.8/stream/promises.d.ts +56 -15
- node/ts4.8/stream/web.d.ts +26 -20
- node/ts4.8/stream.d.ts +326 -219
- node/ts4.8/string_decoder.d.ts +3 -3
- node/ts4.8/test.d.ts +78 -93
- node/ts4.8/timers/promises.d.ts +4 -4
- node/ts4.8/timers.d.ts +23 -8
- node/ts4.8/tls.d.ts +151 -71
- node/ts4.8/trace_events.d.ts +3 -3
- node/ts4.8/tty.d.ts +10 -10
- node/ts4.8/url.d.ts +26 -14
- node/ts4.8/util.d.ts +178 -116
- node/ts4.8/v8.d.ts +4 -4
- node/ts4.8/vm.d.ts +52 -46
- node/ts4.8/wasi.d.ts +3 -3
- node/ts4.8/worker_threads.d.ts +81 -84
- node/ts4.8/zlib.d.ts +9 -9
- node/tty.d.ts +10 -10
- node/url.d.ts +26 -14
- node/util.d.ts +178 -116
- node/v8.d.ts +4 -4
- node/vm.d.ts +52 -46
- node/wasi.d.ts +3 -3
- node/worker_threads.d.ts +81 -84
- node/zlib.d.ts +9 -9
node/util.d.ts
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* ```
|
|
9
9
|
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/util.js)
|
|
10
10
|
*/
|
|
11
|
-
declare module
|
|
12
|
-
import * as types from
|
|
11
|
+
declare module "util" {
|
|
12
|
+
import * as types from "node:util/types";
|
|
13
13
|
export interface InspectOptions {
|
|
14
14
|
/**
|
|
15
15
|
* If `true`, object's non-enumerable symbols and properties are included in the formatted result.
|
|
@@ -85,14 +85,25 @@ declare module 'util' {
|
|
|
85
85
|
* the getter function.
|
|
86
86
|
* @default false
|
|
87
87
|
*/
|
|
88
|
-
getters?:
|
|
88
|
+
getters?: "get" | "set" | boolean | undefined;
|
|
89
89
|
/**
|
|
90
90
|
* If set to `true`, an underscore is used to separate every three digits in all bigints and numbers.
|
|
91
91
|
* @default false
|
|
92
92
|
*/
|
|
93
93
|
numericSeparator?: boolean | undefined;
|
|
94
94
|
}
|
|
95
|
-
export type Style =
|
|
95
|
+
export type Style =
|
|
96
|
+
| "special"
|
|
97
|
+
| "number"
|
|
98
|
+
| "bigint"
|
|
99
|
+
| "boolean"
|
|
100
|
+
| "undefined"
|
|
101
|
+
| "null"
|
|
102
|
+
| "string"
|
|
103
|
+
| "symbol"
|
|
104
|
+
| "date"
|
|
105
|
+
| "regexp"
|
|
106
|
+
| "module";
|
|
96
107
|
export type CustomInspectFunction = (depth: number, options: InspectOptionsStylized) => any; // TODO: , inspect: inspect
|
|
97
108
|
export interface InspectOptionsStylized extends InspectOptions {
|
|
98
109
|
stylize(text: string, styleType: Style): string;
|
|
@@ -970,40 +981,83 @@ declare module 'util' {
|
|
|
970
981
|
* @return a callback style function
|
|
971
982
|
*/
|
|
972
983
|
export function callbackify(fn: () => Promise<void>): (callback: (err: NodeJS.ErrnoException) => void) => void;
|
|
973
|
-
export function callbackify<TResult>(
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
export function callbackify<T1
|
|
977
|
-
|
|
978
|
-
|
|
984
|
+
export function callbackify<TResult>(
|
|
985
|
+
fn: () => Promise<TResult>,
|
|
986
|
+
): (callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
|
|
987
|
+
export function callbackify<T1>(
|
|
988
|
+
fn: (arg1: T1) => Promise<void>,
|
|
989
|
+
): (arg1: T1, callback: (err: NodeJS.ErrnoException) => void) => void;
|
|
990
|
+
export function callbackify<T1, TResult>(
|
|
991
|
+
fn: (arg1: T1) => Promise<TResult>,
|
|
992
|
+
): (arg1: T1, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
|
|
993
|
+
export function callbackify<T1, T2>(
|
|
994
|
+
fn: (arg1: T1, arg2: T2) => Promise<void>,
|
|
995
|
+
): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void;
|
|
996
|
+
export function callbackify<T1, T2, TResult>(
|
|
997
|
+
fn: (arg1: T1, arg2: T2) => Promise<TResult>,
|
|
998
|
+
): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
|
999
|
+
export function callbackify<T1, T2, T3>(
|
|
1000
|
+
fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<void>,
|
|
1001
|
+
): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void;
|
|
979
1002
|
export function callbackify<T1, T2, T3, TResult>(
|
|
980
|
-
fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult
|
|
1003
|
+
fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>,
|
|
981
1004
|
): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
|
|
982
1005
|
export function callbackify<T1, T2, T3, T4>(
|
|
983
|
-
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void
|
|
1006
|
+
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>,
|
|
984
1007
|
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void;
|
|
985
1008
|
export function callbackify<T1, T2, T3, T4, TResult>(
|
|
986
|
-
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult
|
|
987
|
-
): (
|
|
1009
|
+
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>,
|
|
1010
|
+
): (
|
|
1011
|
+
arg1: T1,
|
|
1012
|
+
arg2: T2,
|
|
1013
|
+
arg3: T3,
|
|
1014
|
+
arg4: T4,
|
|
1015
|
+
callback: (err: NodeJS.ErrnoException | null, result: TResult) => void,
|
|
1016
|
+
) => void;
|
|
988
1017
|
export function callbackify<T1, T2, T3, T4, T5>(
|
|
989
|
-
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void
|
|
1018
|
+
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>,
|
|
990
1019
|
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void;
|
|
991
1020
|
export function callbackify<T1, T2, T3, T4, T5, TResult>(
|
|
992
|
-
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult
|
|
993
|
-
): (
|
|
1021
|
+
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>,
|
|
1022
|
+
): (
|
|
1023
|
+
arg1: T1,
|
|
1024
|
+
arg2: T2,
|
|
1025
|
+
arg3: T3,
|
|
1026
|
+
arg4: T4,
|
|
1027
|
+
arg5: T5,
|
|
1028
|
+
callback: (err: NodeJS.ErrnoException | null, result: TResult) => void,
|
|
1029
|
+
) => void;
|
|
994
1030
|
export function callbackify<T1, T2, T3, T4, T5, T6>(
|
|
995
|
-
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<void
|
|
996
|
-
): (
|
|
1031
|
+
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<void>,
|
|
1032
|
+
): (
|
|
1033
|
+
arg1: T1,
|
|
1034
|
+
arg2: T2,
|
|
1035
|
+
arg3: T3,
|
|
1036
|
+
arg4: T4,
|
|
1037
|
+
arg5: T5,
|
|
1038
|
+
arg6: T6,
|
|
1039
|
+
callback: (err: NodeJS.ErrnoException) => void,
|
|
1040
|
+
) => void;
|
|
997
1041
|
export function callbackify<T1, T2, T3, T4, T5, T6, TResult>(
|
|
998
|
-
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<TResult
|
|
999
|
-
): (
|
|
1042
|
+
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<TResult>,
|
|
1043
|
+
): (
|
|
1044
|
+
arg1: T1,
|
|
1045
|
+
arg2: T2,
|
|
1046
|
+
arg3: T3,
|
|
1047
|
+
arg4: T4,
|
|
1048
|
+
arg5: T5,
|
|
1049
|
+
arg6: T6,
|
|
1050
|
+
callback: (err: NodeJS.ErrnoException | null, result: TResult) => void,
|
|
1051
|
+
) => void;
|
|
1000
1052
|
export interface CustomPromisifyLegacy<TCustom extends Function> extends Function {
|
|
1001
1053
|
__promisify__: TCustom;
|
|
1002
1054
|
}
|
|
1003
1055
|
export interface CustomPromisifySymbol<TCustom extends Function> extends Function {
|
|
1004
1056
|
[promisify.custom]: TCustom;
|
|
1005
1057
|
}
|
|
1006
|
-
export type CustomPromisify<TCustom extends Function> =
|
|
1058
|
+
export type CustomPromisify<TCustom extends Function> =
|
|
1059
|
+
| CustomPromisifySymbol<TCustom>
|
|
1060
|
+
| CustomPromisifyLegacy<TCustom>;
|
|
1007
1061
|
/**
|
|
1008
1062
|
* Takes a function following the common error-first callback style, i.e. taking
|
|
1009
1063
|
* an `(err, value) => ...` callback as the last argument, and returns a version
|
|
@@ -1072,23 +1126,37 @@ declare module 'util' {
|
|
|
1072
1126
|
* @since v8.0.0
|
|
1073
1127
|
*/
|
|
1074
1128
|
export function promisify<TCustom extends Function>(fn: CustomPromisify<TCustom>): TCustom;
|
|
1075
|
-
export function promisify<TResult>(
|
|
1129
|
+
export function promisify<TResult>(
|
|
1130
|
+
fn: (callback: (err: any, result: TResult) => void) => void,
|
|
1131
|
+
): () => Promise<TResult>;
|
|
1076
1132
|
export function promisify(fn: (callback: (err?: any) => void) => void): () => Promise<void>;
|
|
1077
|
-
export function promisify<T1, TResult>(
|
|
1133
|
+
export function promisify<T1, TResult>(
|
|
1134
|
+
fn: (arg1: T1, callback: (err: any, result: TResult) => void) => void,
|
|
1135
|
+
): (arg1: T1) => Promise<TResult>;
|
|
1078
1136
|
export function promisify<T1>(fn: (arg1: T1, callback: (err?: any) => void) => void): (arg1: T1) => Promise<void>;
|
|
1079
|
-
export function promisify<T1, T2, TResult>(
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
export function promisify<T1, T2
|
|
1137
|
+
export function promisify<T1, T2, TResult>(
|
|
1138
|
+
fn: (arg1: T1, arg2: T2, callback: (err: any, result: TResult) => void) => void,
|
|
1139
|
+
): (arg1: T1, arg2: T2) => Promise<TResult>;
|
|
1140
|
+
export function promisify<T1, T2>(
|
|
1141
|
+
fn: (arg1: T1, arg2: T2, callback: (err?: any) => void) => void,
|
|
1142
|
+
): (arg1: T1, arg2: T2) => Promise<void>;
|
|
1143
|
+
export function promisify<T1, T2, T3, TResult>(
|
|
1144
|
+
fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: any, result: TResult) => void) => void,
|
|
1145
|
+
): (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>;
|
|
1146
|
+
export function promisify<T1, T2, T3>(
|
|
1147
|
+
fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: any) => void) => void,
|
|
1148
|
+
): (arg1: T1, arg2: T2, arg3: T3) => Promise<void>;
|
|
1083
1149
|
export function promisify<T1, T2, T3, T4, TResult>(
|
|
1084
|
-
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: any, result: TResult) => void) => void
|
|
1150
|
+
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: any, result: TResult) => void) => void,
|
|
1085
1151
|
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>;
|
|
1086
|
-
export function promisify<T1, T2, T3, T4>(
|
|
1152
|
+
export function promisify<T1, T2, T3, T4>(
|
|
1153
|
+
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: any) => void) => void,
|
|
1154
|
+
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>;
|
|
1087
1155
|
export function promisify<T1, T2, T3, T4, T5, TResult>(
|
|
1088
|
-
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: any, result: TResult) => void) => void
|
|
1156
|
+
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: any, result: TResult) => void) => void,
|
|
1089
1157
|
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>;
|
|
1090
1158
|
export function promisify<T1, T2, T3, T4, T5>(
|
|
1091
|
-
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: any) => void) => void
|
|
1159
|
+
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: any) => void) => void,
|
|
1092
1160
|
): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>;
|
|
1093
1161
|
export function promisify(fn: Function): Function;
|
|
1094
1162
|
export namespace promisify {
|
|
@@ -1127,7 +1195,7 @@ declare module 'util' {
|
|
|
1127
1195
|
options?: {
|
|
1128
1196
|
fatal?: boolean | undefined;
|
|
1129
1197
|
ignoreBOM?: boolean | undefined;
|
|
1130
|
-
}
|
|
1198
|
+
},
|
|
1131
1199
|
);
|
|
1132
1200
|
/**
|
|
1133
1201
|
* Decodes the `input` and returns a string. If `options.stream` is `true`, any
|
|
@@ -1141,7 +1209,7 @@ declare module 'util' {
|
|
|
1141
1209
|
input?: NodeJS.ArrayBufferView | ArrayBuffer | null,
|
|
1142
1210
|
options?: {
|
|
1143
1211
|
stream?: boolean | undefined;
|
|
1144
|
-
}
|
|
1212
|
+
},
|
|
1145
1213
|
): string;
|
|
1146
1214
|
}
|
|
1147
1215
|
export interface EncodeIntoResult {
|
|
@@ -1195,7 +1263,7 @@ declare module 'util' {
|
|
|
1195
1263
|
*/
|
|
1196
1264
|
encodeInto(src: string, dest: Uint8Array): EncodeIntoResult;
|
|
1197
1265
|
}
|
|
1198
|
-
import { TextDecoder as _TextDecoder, TextEncoder as _TextEncoder } from
|
|
1266
|
+
import { TextDecoder as _TextDecoder, TextEncoder as _TextEncoder } from "util";
|
|
1199
1267
|
global {
|
|
1200
1268
|
/**
|
|
1201
1269
|
* `TextDecoder` class is a global reference for `require('util').TextDecoder`
|
|
@@ -1205,8 +1273,7 @@ declare module 'util' {
|
|
|
1205
1273
|
var TextDecoder: typeof globalThis extends {
|
|
1206
1274
|
onmessage: any;
|
|
1207
1275
|
TextDecoder: infer TextDecoder;
|
|
1208
|
-
}
|
|
1209
|
-
? TextDecoder
|
|
1276
|
+
} ? TextDecoder
|
|
1210
1277
|
: typeof _TextDecoder;
|
|
1211
1278
|
/**
|
|
1212
1279
|
* `TextEncoder` class is a global reference for `require('util').TextEncoder`
|
|
@@ -1216,8 +1283,7 @@ declare module 'util' {
|
|
|
1216
1283
|
var TextEncoder: typeof globalThis extends {
|
|
1217
1284
|
onmessage: any;
|
|
1218
1285
|
TextEncoder: infer TextEncoder;
|
|
1219
|
-
}
|
|
1220
|
-
? TextEncoder
|
|
1286
|
+
} ? TextEncoder
|
|
1221
1287
|
: typeof _TextEncoder;
|
|
1222
1288
|
}
|
|
1223
1289
|
|
|
@@ -1255,7 +1321,7 @@ declare module 'util' {
|
|
|
1255
1321
|
/**
|
|
1256
1322
|
* Type of argument.
|
|
1257
1323
|
*/
|
|
1258
|
-
type:
|
|
1324
|
+
type: "string" | "boolean";
|
|
1259
1325
|
/**
|
|
1260
1326
|
* Whether this option can be provided multiple times.
|
|
1261
1327
|
* If `true`, all values will be collected in an array.
|
|
@@ -1313,89 +1379,81 @@ declare module 'util' {
|
|
|
1313
1379
|
This is technically incorrect but is a much nicer UX for the common case.
|
|
1314
1380
|
The IfDefaultsTrue version is for things which default to true; the IfDefaultsFalse version is for things which default to false.
|
|
1315
1381
|
*/
|
|
1316
|
-
type IfDefaultsTrue<T, IfTrue, IfFalse> = T extends true
|
|
1317
|
-
?
|
|
1318
|
-
: T extends false
|
|
1319
|
-
? IfFalse
|
|
1382
|
+
type IfDefaultsTrue<T, IfTrue, IfFalse> = T extends true ? IfTrue
|
|
1383
|
+
: T extends false ? IfFalse
|
|
1320
1384
|
: IfTrue;
|
|
1321
1385
|
|
|
1322
1386
|
// we put the `extends false` condition first here because `undefined` compares like `any` when `strictNullChecks: false`
|
|
1323
|
-
type IfDefaultsFalse<T, IfTrue, IfFalse> = T extends false
|
|
1324
|
-
?
|
|
1325
|
-
: T extends true
|
|
1326
|
-
? IfTrue
|
|
1387
|
+
type IfDefaultsFalse<T, IfTrue, IfFalse> = T extends false ? IfFalse
|
|
1388
|
+
: T extends true ? IfTrue
|
|
1327
1389
|
: IfFalse;
|
|
1328
1390
|
|
|
1329
1391
|
type ExtractOptionValue<T extends ParseArgsConfig, O extends ParseArgsOptionConfig> = IfDefaultsTrue<
|
|
1330
|
-
T[
|
|
1331
|
-
O[
|
|
1392
|
+
T["strict"],
|
|
1393
|
+
O["type"] extends "string" ? string : O["type"] extends "boolean" ? boolean : string | boolean,
|
|
1332
1394
|
string | boolean
|
|
1333
1395
|
>;
|
|
1334
1396
|
|
|
1335
1397
|
type ParsedValues<T extends ParseArgsConfig> =
|
|
1336
|
-
& IfDefaultsTrue<T[
|
|
1337
|
-
& (T[
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
T[
|
|
1341
|
-
undefined |
|
|
1342
|
-
undefined | ExtractOptionValue<T, T['options'][LongOption]>
|
|
1398
|
+
& IfDefaultsTrue<T["strict"], unknown, { [longOption: string]: undefined | string | boolean }>
|
|
1399
|
+
& (T["options"] extends ParseArgsOptionsConfig ? {
|
|
1400
|
+
-readonly [LongOption in keyof T["options"]]: IfDefaultsFalse<
|
|
1401
|
+
T["options"][LongOption]["multiple"],
|
|
1402
|
+
undefined | Array<ExtractOptionValue<T, T["options"][LongOption]>>,
|
|
1403
|
+
undefined | ExtractOptionValue<T, T["options"][LongOption]>
|
|
1343
1404
|
>;
|
|
1344
1405
|
}
|
|
1345
1406
|
: {});
|
|
1346
1407
|
|
|
1347
1408
|
type ParsedPositionals<T extends ParseArgsConfig> = IfDefaultsTrue<
|
|
1348
|
-
T[
|
|
1349
|
-
IfDefaultsFalse<T[
|
|
1350
|
-
IfDefaultsTrue<T[
|
|
1409
|
+
T["strict"],
|
|
1410
|
+
IfDefaultsFalse<T["allowPositionals"], string[], []>,
|
|
1411
|
+
IfDefaultsTrue<T["allowPositionals"], string[], []>
|
|
1351
1412
|
>;
|
|
1352
1413
|
|
|
1353
1414
|
type PreciseTokenForOptions<
|
|
1354
1415
|
K extends string,
|
|
1355
1416
|
O extends ParseArgsOptionConfig,
|
|
1356
|
-
> = O[
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
inlineValue: undefined;
|
|
1373
|
-
}
|
|
1417
|
+
> = O["type"] extends "string" ? {
|
|
1418
|
+
kind: "option";
|
|
1419
|
+
index: number;
|
|
1420
|
+
name: K;
|
|
1421
|
+
rawName: string;
|
|
1422
|
+
value: string;
|
|
1423
|
+
inlineValue: boolean;
|
|
1424
|
+
}
|
|
1425
|
+
: O["type"] extends "boolean" ? {
|
|
1426
|
+
kind: "option";
|
|
1427
|
+
index: number;
|
|
1428
|
+
name: K;
|
|
1429
|
+
rawName: string;
|
|
1430
|
+
value: undefined;
|
|
1431
|
+
inlineValue: undefined;
|
|
1432
|
+
}
|
|
1374
1433
|
: OptionToken & { name: K };
|
|
1375
1434
|
|
|
1376
1435
|
type TokenForOptions<
|
|
1377
1436
|
T extends ParseArgsConfig,
|
|
1378
|
-
K extends keyof T[
|
|
1437
|
+
K extends keyof T["options"] = keyof T["options"],
|
|
1379
1438
|
> = K extends unknown
|
|
1380
|
-
? T[
|
|
1381
|
-
|
|
1382
|
-
: OptionToken
|
|
1439
|
+
? T["options"] extends ParseArgsOptionsConfig ? PreciseTokenForOptions<K & string, T["options"][K]>
|
|
1440
|
+
: OptionToken
|
|
1383
1441
|
: never;
|
|
1384
1442
|
|
|
1385
|
-
type ParsedOptionToken<T extends ParseArgsConfig> = IfDefaultsTrue<T[
|
|
1443
|
+
type ParsedOptionToken<T extends ParseArgsConfig> = IfDefaultsTrue<T["strict"], TokenForOptions<T>, OptionToken>;
|
|
1386
1444
|
|
|
1387
1445
|
type ParsedPositionalToken<T extends ParseArgsConfig> = IfDefaultsTrue<
|
|
1388
|
-
T[
|
|
1389
|
-
IfDefaultsFalse<T[
|
|
1390
|
-
IfDefaultsTrue<T[
|
|
1446
|
+
T["strict"],
|
|
1447
|
+
IfDefaultsFalse<T["allowPositionals"], { kind: "positional"; index: number; value: string }, never>,
|
|
1448
|
+
IfDefaultsTrue<T["allowPositionals"], { kind: "positional"; index: number; value: string }, never>
|
|
1391
1449
|
>;
|
|
1392
1450
|
|
|
1393
1451
|
type ParsedTokens<T extends ParseArgsConfig> = Array<
|
|
1394
|
-
ParsedOptionToken<T> | ParsedPositionalToken<T> | { kind:
|
|
1452
|
+
ParsedOptionToken<T> | ParsedPositionalToken<T> | { kind: "option-terminator"; index: number }
|
|
1395
1453
|
>;
|
|
1396
1454
|
|
|
1397
1455
|
type PreciseParsedResults<T extends ParseArgsConfig> = IfDefaultsFalse<
|
|
1398
|
-
T[
|
|
1456
|
+
T["tokens"],
|
|
1399
1457
|
{
|
|
1400
1458
|
values: ParsedValues<T>;
|
|
1401
1459
|
positionals: ParsedPositionals<T>;
|
|
@@ -1408,31 +1466,30 @@ declare module 'util' {
|
|
|
1408
1466
|
>;
|
|
1409
1467
|
|
|
1410
1468
|
type OptionToken =
|
|
1411
|
-
| { kind:
|
|
1469
|
+
| { kind: "option"; index: number; name: string; rawName: string; value: string; inlineValue: boolean }
|
|
1412
1470
|
| {
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1471
|
+
kind: "option";
|
|
1472
|
+
index: number;
|
|
1473
|
+
name: string;
|
|
1474
|
+
rawName: string;
|
|
1475
|
+
value: undefined;
|
|
1476
|
+
inlineValue: undefined;
|
|
1477
|
+
};
|
|
1420
1478
|
|
|
1421
1479
|
type Token =
|
|
1422
1480
|
| OptionToken
|
|
1423
|
-
| { kind:
|
|
1424
|
-
| { kind:
|
|
1481
|
+
| { kind: "positional"; index: number; value: string }
|
|
1482
|
+
| { kind: "option-terminator"; index: number };
|
|
1425
1483
|
|
|
1426
1484
|
// If ParseArgsConfig extends T, then the user passed config constructed elsewhere.
|
|
1427
1485
|
// So we can't rely on the `"not definitely present" implies "definitely not present"` assumption mentioned above.
|
|
1428
|
-
type ParsedResults<T extends ParseArgsConfig> = ParseArgsConfig extends T
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
}
|
|
1486
|
+
type ParsedResults<T extends ParseArgsConfig> = ParseArgsConfig extends T ? {
|
|
1487
|
+
values: {
|
|
1488
|
+
[longOption: string]: undefined | string | boolean | Array<string | boolean>;
|
|
1489
|
+
};
|
|
1490
|
+
positionals: string[];
|
|
1491
|
+
tokens?: Token[];
|
|
1492
|
+
}
|
|
1436
1493
|
: PreciseParsedResults<T>;
|
|
1437
1494
|
|
|
1438
1495
|
/**
|
|
@@ -1589,11 +1646,11 @@ declare module 'util' {
|
|
|
1589
1646
|
[Symbol.iterator]: typeof MIMEParams.prototype.entries;
|
|
1590
1647
|
}
|
|
1591
1648
|
}
|
|
1592
|
-
declare module
|
|
1593
|
-
export * from
|
|
1649
|
+
declare module "util/types" {
|
|
1650
|
+
export * from "util/types";
|
|
1594
1651
|
}
|
|
1595
|
-
declare module
|
|
1596
|
-
import { KeyObject, webcrypto } from
|
|
1652
|
+
declare module "util/types" {
|
|
1653
|
+
import { KeyObject, webcrypto } from "node:crypto";
|
|
1597
1654
|
/**
|
|
1598
1655
|
* Returns `true` if the value is a built-in [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) or
|
|
1599
1656
|
* [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instance.
|
|
@@ -1859,7 +1916,10 @@ declare module 'util/types' {
|
|
|
1859
1916
|
* ```
|
|
1860
1917
|
* @since v10.0.0
|
|
1861
1918
|
*/
|
|
1862
|
-
function isMap<T>(
|
|
1919
|
+
function isMap<T>(
|
|
1920
|
+
object: T | {},
|
|
1921
|
+
): object is T extends ReadonlyMap<any, any> ? (unknown extends T ? never : ReadonlyMap<any, any>)
|
|
1922
|
+
: Map<unknown, unknown>;
|
|
1863
1923
|
/**
|
|
1864
1924
|
* Returns `true` if the value is an iterator returned for a built-in [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) instance.
|
|
1865
1925
|
*
|
|
@@ -1973,7 +2033,9 @@ declare module 'util/types' {
|
|
|
1973
2033
|
* ```
|
|
1974
2034
|
* @since v10.0.0
|
|
1975
2035
|
*/
|
|
1976
|
-
function isSet<T>(
|
|
2036
|
+
function isSet<T>(
|
|
2037
|
+
object: T | {},
|
|
2038
|
+
): object is T extends ReadonlySet<any> ? (unknown extends T ? never : ReadonlySet<any>) : Set<unknown>;
|
|
1977
2039
|
/**
|
|
1978
2040
|
* 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.
|
|
1979
2041
|
*
|
|
@@ -2108,9 +2170,9 @@ declare module 'util/types' {
|
|
|
2108
2170
|
*/
|
|
2109
2171
|
function isCryptoKey(object: unknown): object is webcrypto.CryptoKey;
|
|
2110
2172
|
}
|
|
2111
|
-
declare module
|
|
2112
|
-
export * from
|
|
2173
|
+
declare module "node:util" {
|
|
2174
|
+
export * from "util";
|
|
2113
2175
|
}
|
|
2114
|
-
declare module
|
|
2115
|
-
export * from
|
|
2176
|
+
declare module "node:util/types" {
|
|
2177
|
+
export * from "util/types";
|
|
2116
2178
|
}
|
node/v8.d.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* ```
|
|
7
7
|
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/v8.js)
|
|
8
8
|
*/
|
|
9
|
-
declare module
|
|
10
|
-
import { Readable } from
|
|
9
|
+
declare module "v8" {
|
|
10
|
+
import { Readable } from "node:stream";
|
|
11
11
|
interface HeapSpaceInfo {
|
|
12
12
|
space_name: string;
|
|
13
13
|
space_size: number;
|
|
@@ -630,6 +630,6 @@ declare module 'v8' {
|
|
|
630
630
|
*/
|
|
631
631
|
const promiseHooks: PromiseHooks;
|
|
632
632
|
}
|
|
633
|
-
declare module
|
|
634
|
-
export * from
|
|
633
|
+
declare module "node:v8" {
|
|
634
|
+
export * from "v8";
|
|
635
635
|
}
|