@types/node 22.18.10 → 22.18.12

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 v22.18/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v22.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Sat, 11 Oct 2025 14:02:18 GMT
11
+ * Last updated: Tue, 21 Oct 2025 00:04:31 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
@@ -451,7 +451,16 @@ declare module "buffer" {
451
451
  */
452
452
  subarray(start?: number, end?: number): Buffer<TArrayBuffer>;
453
453
  }
454
+ // TODO: remove globals in future version
455
+ /**
456
+ * @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
457
+ * TypeScript versions earlier than 5.7.
458
+ */
454
459
  type NonSharedBuffer = Buffer<ArrayBuffer>;
460
+ /**
461
+ * @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
462
+ * TypeScript versions earlier than 5.7.
463
+ */
455
464
  type AllowSharedBuffer = Buffer<ArrayBufferLike>;
456
465
  }
457
466
  /** @deprecated Use `Buffer.allocUnsafeSlow()` instead. */
node v22.18/buffer.d.ts CHANGED
@@ -59,7 +59,7 @@ declare module "buffer" {
59
59
  * @since v19.4.0, v18.14.0
60
60
  * @param input The input to validate.
61
61
  */
62
- export function isUtf8(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean;
62
+ export function isUtf8(input: ArrayBuffer | NodeJS.TypedArray): boolean;
63
63
  /**
64
64
  * This function returns `true` if `input` contains only valid ASCII-encoded data,
65
65
  * including the case in which `input` is empty.
@@ -68,7 +68,7 @@ declare module "buffer" {
68
68
  * @since v19.6.0, v18.15.0
69
69
  * @param input The input to validate.
70
70
  */
71
- export function isAscii(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean;
71
+ export function isAscii(input: ArrayBuffer | NodeJS.TypedArray): boolean;
72
72
  export let INSPECT_MAX_BYTES: number;
73
73
  export const kMaxLength: number;
74
74
  export const kStringMaxLength: number;
@@ -113,7 +113,11 @@ declare module "buffer" {
113
113
  * @param fromEnc The current encoding.
114
114
  * @param toEnc To target encoding.
115
115
  */
116
- export function transcode(source: Uint8Array, fromEnc: TranscodeEncoding, toEnc: TranscodeEncoding): Buffer;
116
+ export function transcode(
117
+ source: Uint8Array,
118
+ fromEnc: TranscodeEncoding,
119
+ toEnc: TranscodeEncoding,
120
+ ): NonSharedBuffer;
117
121
  /**
118
122
  * Resolves a `'blob:nodedata:...'` an associated `Blob` object registered using
119
123
  * a prior call to `URL.createObjectURL()`.
@@ -330,7 +334,7 @@ declare module "buffer" {
330
334
  * @return The number of bytes contained within `string`.
331
335
  */
332
336
  byteLength(
333
- string: string | Buffer | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer,
337
+ string: string | NodeJS.ArrayBufferView | ArrayBufferLike,
334
338
  encoding?: BufferEncoding,
335
339
  ): number;
336
340
  /**
@@ -66,6 +66,7 @@
66
66
  * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/child_process.js)
67
67
  */
68
68
  declare module "child_process" {
69
+ import { NonSharedBuffer } from "node:buffer";
69
70
  import { Abortable, EventEmitter } from "node:events";
70
71
  import * as dgram from "node:dgram";
71
72
  import * as net from "node:net";
@@ -1001,7 +1002,7 @@ declare module "child_process" {
1001
1002
  function exec(
1002
1003
  command: string,
1003
1004
  options: ExecOptionsWithBufferEncoding,
1004
- callback?: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void,
1005
+ callback?: (error: ExecException | null, stdout: NonSharedBuffer, stderr: NonSharedBuffer) => void,
1005
1006
  ): ChildProcess;
1006
1007
  // `options` with well-known or absent `encoding` means stdout/stderr are definitely `string`.
1007
1008
  function exec(
@@ -1013,7 +1014,11 @@ declare module "child_process" {
1013
1014
  function exec(
1014
1015
  command: string,
1015
1016
  options: ExecOptions | undefined | null,
1016
- callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
1017
+ callback?: (
1018
+ error: ExecException | null,
1019
+ stdout: string | NonSharedBuffer,
1020
+ stderr: string | NonSharedBuffer,
1021
+ ) => void,
1017
1022
  ): ChildProcess;
1018
1023
  interface PromiseWithChild<T> extends Promise<T> {
1019
1024
  child: ChildProcess;
@@ -1027,8 +1032,8 @@ declare module "child_process" {
1027
1032
  command: string,
1028
1033
  options: ExecOptionsWithBufferEncoding,
1029
1034
  ): PromiseWithChild<{
1030
- stdout: Buffer;
1031
- stderr: Buffer;
1035
+ stdout: NonSharedBuffer;
1036
+ stderr: NonSharedBuffer;
1032
1037
  }>;
1033
1038
  function __promisify__(
1034
1039
  command: string,
@@ -1041,8 +1046,8 @@ declare module "child_process" {
1041
1046
  command: string,
1042
1047
  options: ExecOptions | undefined | null,
1043
1048
  ): PromiseWithChild<{
1044
- stdout: string | Buffer;
1045
- stderr: string | Buffer;
1049
+ stdout: string | NonSharedBuffer;
1050
+ stderr: string | NonSharedBuffer;
1046
1051
  }>;
1047
1052
  }
1048
1053
  interface ExecFileOptions extends CommonOptions, Abortable {
@@ -1144,13 +1149,13 @@ declare module "child_process" {
1144
1149
  function execFile(
1145
1150
  file: string,
1146
1151
  options: ExecFileOptionsWithBufferEncoding,
1147
- callback?: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void,
1152
+ callback?: (error: ExecFileException | null, stdout: NonSharedBuffer, stderr: NonSharedBuffer) => void,
1148
1153
  ): ChildProcess;
1149
1154
  function execFile(
1150
1155
  file: string,
1151
1156
  args: readonly string[] | undefined | null,
1152
1157
  options: ExecFileOptionsWithBufferEncoding,
1153
- callback?: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void,
1158
+ callback?: (error: ExecFileException | null, stdout: NonSharedBuffer, stderr: NonSharedBuffer) => void,
1154
1159
  ): ChildProcess;
1155
1160
  // `options` with well-known or absent `encoding` means stdout/stderr are definitely `string`.
1156
1161
  function execFile(
@@ -1169,7 +1174,11 @@ declare module "child_process" {
1169
1174
  file: string,
1170
1175
  options: ExecFileOptions | undefined | null,
1171
1176
  callback:
1172
- | ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void)
1177
+ | ((
1178
+ error: ExecFileException | null,
1179
+ stdout: string | NonSharedBuffer,
1180
+ stderr: string | NonSharedBuffer,
1181
+ ) => void)
1173
1182
  | undefined
1174
1183
  | null,
1175
1184
  ): ChildProcess;
@@ -1178,7 +1187,11 @@ declare module "child_process" {
1178
1187
  args: readonly string[] | undefined | null,
1179
1188
  options: ExecFileOptions | undefined | null,
1180
1189
  callback:
1181
- | ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void)
1190
+ | ((
1191
+ error: ExecFileException | null,
1192
+ stdout: string | NonSharedBuffer,
1193
+ stderr: string | NonSharedBuffer,
1194
+ ) => void)
1182
1195
  | undefined
1183
1196
  | null,
1184
1197
  ): ChildProcess;
@@ -1198,16 +1211,16 @@ declare module "child_process" {
1198
1211
  file: string,
1199
1212
  options: ExecFileOptionsWithBufferEncoding,
1200
1213
  ): PromiseWithChild<{
1201
- stdout: Buffer;
1202
- stderr: Buffer;
1214
+ stdout: NonSharedBuffer;
1215
+ stderr: NonSharedBuffer;
1203
1216
  }>;
1204
1217
  function __promisify__(
1205
1218
  file: string,
1206
1219
  args: readonly string[] | undefined | null,
1207
1220
  options: ExecFileOptionsWithBufferEncoding,
1208
1221
  ): PromiseWithChild<{
1209
- stdout: Buffer;
1210
- stderr: Buffer;
1222
+ stdout: NonSharedBuffer;
1223
+ stderr: NonSharedBuffer;
1211
1224
  }>;
1212
1225
  function __promisify__(
1213
1226
  file: string,
@@ -1228,16 +1241,16 @@ declare module "child_process" {
1228
1241
  file: string,
1229
1242
  options: ExecFileOptions | undefined | null,
1230
1243
  ): PromiseWithChild<{
1231
- stdout: string | Buffer;
1232
- stderr: string | Buffer;
1244
+ stdout: string | NonSharedBuffer;
1245
+ stderr: string | NonSharedBuffer;
1233
1246
  }>;
1234
1247
  function __promisify__(
1235
1248
  file: string,
1236
1249
  args: readonly string[] | undefined | null,
1237
1250
  options: ExecFileOptions | undefined | null,
1238
1251
  ): PromiseWithChild<{
1239
- stdout: string | Buffer;
1240
- stderr: string | Buffer;
1252
+ stdout: string | NonSharedBuffer;
1253
+ stderr: string | NonSharedBuffer;
1241
1254
  }>;
1242
1255
  }
1243
1256
  interface ForkOptions extends ProcessEnvOptions, MessagingOptions, Abortable {
@@ -1343,11 +1356,11 @@ declare module "child_process" {
1343
1356
  * @param command The command to run.
1344
1357
  * @param args List of string arguments.
1345
1358
  */
1346
- function spawnSync(command: string): SpawnSyncReturns<Buffer>;
1359
+ function spawnSync(command: string): SpawnSyncReturns<NonSharedBuffer>;
1347
1360
  function spawnSync(command: string, options: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
1348
- function spawnSync(command: string, options: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
1349
- function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns<string | Buffer>;
1350
- function spawnSync(command: string, args: readonly string[]): SpawnSyncReturns<Buffer>;
1361
+ function spawnSync(command: string, options: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<NonSharedBuffer>;
1362
+ function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns<string | NonSharedBuffer>;
1363
+ function spawnSync(command: string, args: readonly string[]): SpawnSyncReturns<NonSharedBuffer>;
1351
1364
  function spawnSync(
1352
1365
  command: string,
1353
1366
  args: readonly string[],
@@ -1357,12 +1370,12 @@ declare module "child_process" {
1357
1370
  command: string,
1358
1371
  args: readonly string[],
1359
1372
  options: SpawnSyncOptionsWithBufferEncoding,
1360
- ): SpawnSyncReturns<Buffer>;
1373
+ ): SpawnSyncReturns<NonSharedBuffer>;
1361
1374
  function spawnSync(
1362
1375
  command: string,
1363
1376
  args?: readonly string[],
1364
1377
  options?: SpawnSyncOptions,
1365
- ): SpawnSyncReturns<string | Buffer>;
1378
+ ): SpawnSyncReturns<string | NonSharedBuffer>;
1366
1379
  interface CommonExecOptions extends CommonOptions {
1367
1380
  input?: string | NodeJS.ArrayBufferView | undefined;
1368
1381
  /**
@@ -1404,10 +1417,10 @@ declare module "child_process" {
1404
1417
  * @param command The command to run.
1405
1418
  * @return The stdout from the command.
1406
1419
  */
1407
- function execSync(command: string): Buffer;
1420
+ function execSync(command: string): NonSharedBuffer;
1408
1421
  function execSync(command: string, options: ExecSyncOptionsWithStringEncoding): string;
1409
- function execSync(command: string, options: ExecSyncOptionsWithBufferEncoding): Buffer;
1410
- function execSync(command: string, options?: ExecSyncOptions): string | Buffer;
1422
+ function execSync(command: string, options: ExecSyncOptionsWithBufferEncoding): NonSharedBuffer;
1423
+ function execSync(command: string, options?: ExecSyncOptions): string | NonSharedBuffer;
1411
1424
  interface ExecFileSyncOptions extends CommonExecOptions {
1412
1425
  shell?: boolean | string | undefined;
1413
1426
  }
@@ -1437,11 +1450,11 @@ declare module "child_process" {
1437
1450
  * @param args List of string arguments.
1438
1451
  * @return The stdout from the command.
1439
1452
  */
1440
- function execFileSync(file: string): Buffer;
1453
+ function execFileSync(file: string): NonSharedBuffer;
1441
1454
  function execFileSync(file: string, options: ExecFileSyncOptionsWithStringEncoding): string;
1442
- function execFileSync(file: string, options: ExecFileSyncOptionsWithBufferEncoding): Buffer;
1443
- function execFileSync(file: string, options?: ExecFileSyncOptions): string | Buffer;
1444
- function execFileSync(file: string, args: readonly string[]): Buffer;
1455
+ function execFileSync(file: string, options: ExecFileSyncOptionsWithBufferEncoding): NonSharedBuffer;
1456
+ function execFileSync(file: string, options?: ExecFileSyncOptions): string | NonSharedBuffer;
1457
+ function execFileSync(file: string, args: readonly string[]): NonSharedBuffer;
1445
1458
  function execFileSync(
1446
1459
  file: string,
1447
1460
  args: readonly string[],
@@ -1451,8 +1464,12 @@ declare module "child_process" {
1451
1464
  file: string,
1452
1465
  args: readonly string[],
1453
1466
  options: ExecFileSyncOptionsWithBufferEncoding,
1454
- ): Buffer;
1455
- function execFileSync(file: string, args?: readonly string[], options?: ExecFileSyncOptions): string | Buffer;
1467
+ ): NonSharedBuffer;
1468
+ function execFileSync(
1469
+ file: string,
1470
+ args?: readonly string[],
1471
+ options?: ExecFileSyncOptions,
1472
+ ): string | NonSharedBuffer;
1456
1473
  }
1457
1474
  declare module "node:child_process" {
1458
1475
  export * from "child_process";
@@ -72,7 +72,7 @@ declare module "cluster" {
72
72
  * String arguments passed to worker.
73
73
  * @default process.argv.slice(2)
74
74
  */
75
- args?: string[] | undefined;
75
+ args?: readonly string[] | undefined;
76
76
  /**
77
77
  * Whether or not to send output to parent's stdio.
78
78
  * @default false