@types/node 15.14.7 → 16.0.1

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.
Files changed (65) hide show
  1. {node v15.14 → node}/LICENSE +0 -0
  2. node v15.14/README.md → node/README.md +3 -3
  3. node/assert/strict.d.ts +9 -0
  4. node v15.14/assert.d.ts → node/assert.d.ts +35 -30
  5. node v15.14/async_hooks.d.ts → node/async_hooks.d.ts +7 -3
  6. {node v15.14 → node}/base.d.ts +0 -0
  7. node/buffer.d.ts +357 -0
  8. node v15.14/child_process.d.ts → node/child_process.d.ts +54 -50
  9. node v15.14/cluster.d.ts → node/cluster.d.ts +33 -108
  10. node v15.14/console.d.ts → node/console.d.ts +24 -23
  11. node v15.14/constants.d.ts → node/constants.d.ts +5 -0
  12. node v15.14/crypto.d.ts → node/crypto.d.ts +82 -67
  13. node v15.14/dgram.d.ts → node/dgram.d.ts +13 -9
  14. node v15.14/diagnostic_channel.d.ts → node/diagnostic_channel.d.ts +4 -0
  15. node v15.14/dns/promises.d.ts → node/dns/promises.d.ts +4 -0
  16. node v15.14/dns.d.ts → node/dns.d.ts +15 -11
  17. node/domain.d.ts +25 -0
  18. node v15.14/events.d.ts → node/events.d.ts +8 -3
  19. node v15.14/fs/promises.d.ts → node/fs/promises.d.ts +25 -17
  20. node v15.14/fs.d.ts → node/fs.d.ts +71 -75
  21. node/globals.d.ts +274 -0
  22. node/globals.global.d.ts +1 -0
  23. node v15.14/http.d.ts → node/http.d.ts +109 -167
  24. node v15.14/http2.d.ts → node/http2.d.ts +69 -66
  25. node/https.d.ts +40 -0
  26. node v15.14/index.d.ts → node/index.d.ts +1 -1
  27. node v15.14/inspector.d.ts → node/inspector.d.ts +152 -470
  28. node v15.14/module.d.ts → node/module.d.ts +25 -4
  29. node v15.14/net.d.ts → node/net.d.ts +34 -36
  30. node v15.14/os.d.ts → node/os.d.ts +4 -0
  31. node v15.14/package.json → node/package.json +2 -2
  32. node v15.14/path.d.ts → node/path.d.ts +10 -5
  33. node v15.14/perf_hooks.d.ts → node/perf_hooks.d.ts +70 -23
  34. node v15.14/process.d.ts → node/process.d.ts +54 -51
  35. node v15.14/punycode.d.ts → node/punycode.d.ts +4 -0
  36. node v15.14/querystring.d.ts → node/querystring.d.ts +7 -3
  37. node v15.14/readline.d.ts → node/readline.d.ts +20 -16
  38. node v15.14/repl.d.ts → node/repl.d.ts +18 -14
  39. node v15.14/stream/promises.d.ts → node/stream/promises.d.ts +4 -0
  40. node v15.14/stream.d.ts → node/stream.d.ts +22 -17
  41. node v15.14/string_decoder.d.ts → node/string_decoder.d.ts +4 -0
  42. node v15.14/timers/promises.d.ts → node/timers/promises.d.ts +4 -0
  43. node/timers.d.ts +92 -0
  44. node v15.14/tls.d.ts → node/tls.d.ts +54 -50
  45. node v15.14/trace_events.d.ts → node/trace_events.d.ts +4 -0
  46. node v15.14/ts3.6/assert.d.ts → node/ts3.6/assert.d.ts +26 -26
  47. {node v15.14 → node}/ts3.6/base.d.ts +0 -0
  48. {node v15.14 → node}/ts3.6/index.d.ts +0 -0
  49. node v15.14/tty.d.ts → node/tty.d.ts +4 -0
  50. node v15.14/url.d.ts → node/url.d.ts +19 -15
  51. node/util/types.d.ts +57 -0
  52. node v15.14/util.d.ts → node/util.d.ts +67 -21
  53. node v15.14/v8.d.ts → node/v8.d.ts +4 -0
  54. node v15.14/vm.d.ts → node/vm.d.ts +28 -24
  55. node v15.14/wasi.d.ts → node/wasi.d.ts +11 -7
  56. node v15.14/worker_threads.d.ts → node/worker_threads.d.ts +19 -15
  57. node v15.14/zlib.d.ts → node/zlib.d.ts +20 -16
  58. node v15.14/assert/strict.d.ts +0 -4
  59. node v15.14/buffer.d.ts +0 -112
  60. node v15.14/domain.d.ts +0 -24
  61. node v15.14/globals.d.ts +0 -659
  62. node v15.14/globals.global.d.ts +0 -1
  63. node v15.14/https.d.ts +0 -139
  64. node v15.14/timers.d.ts +0 -27
  65. node v15.14/util/types.d.ts +0 -53
@@ -11,7 +11,7 @@ declare module 'child_process' {
11
11
  stdin: Writable | null;
12
12
  stdout: Readable | null;
13
13
  stderr: Readable | null;
14
- readonly channel?: Pipe | null;
14
+ readonly channel?: Pipe | null | undefined;
15
15
  readonly stdio: [
16
16
  Writable | null, // stdin
17
17
  Readable | null, // stdout
@@ -20,7 +20,7 @@ declare module 'child_process' {
20
20
  Readable | Writable | null | undefined // extra
21
21
  ];
22
22
  readonly killed: boolean;
23
- readonly pid?: number;
23
+ readonly pid?: number | undefined;
24
24
  readonly connected: boolean;
25
25
  readonly exitCode: number | null;
26
26
  readonly signalCode: NodeJS.Signals | null;
@@ -126,7 +126,7 @@ declare module 'child_process' {
126
126
  }
127
127
 
128
128
  interface MessageOptions {
129
- keepOpen?: boolean;
129
+ keepOpen?: boolean | undefined;
130
130
  }
131
131
 
132
132
  type IOType = "overlapped" | "pipe" | "ignore" | "inherit";
@@ -140,51 +140,51 @@ declare module 'child_process' {
140
140
  * Specify the kind of serialization used for sending messages between processes.
141
141
  * @default 'json'
142
142
  */
143
- serialization?: SerializationType;
143
+ serialization?: SerializationType | undefined;
144
144
 
145
145
  /**
146
146
  * The signal value to be used when the spawned process will be killed by the abort signal.
147
147
  * @default 'SIGTERM'
148
148
  */
149
- killSignal?: NodeJS.Signals | number;
149
+ killSignal?: NodeJS.Signals | number | undefined;
150
150
 
151
151
  /**
152
152
  * In milliseconds the maximum amount of time the process is allowed to run.
153
153
  */
154
- timeout?: number;
154
+ timeout?: number | undefined;
155
155
  }
156
156
 
157
157
  interface ProcessEnvOptions {
158
- uid?: number;
159
- gid?: number;
160
- cwd?: string;
161
- env?: NodeJS.ProcessEnv;
158
+ uid?: number | undefined;
159
+ gid?: number | undefined;
160
+ cwd?: string | undefined;
161
+ env?: NodeJS.ProcessEnv | undefined;
162
162
  }
163
163
 
164
164
  interface CommonOptions extends ProcessEnvOptions {
165
165
  /**
166
166
  * @default true
167
167
  */
168
- windowsHide?: boolean;
168
+ windowsHide?: boolean | undefined;
169
169
  /**
170
170
  * @default 0
171
171
  */
172
- timeout?: number;
172
+ timeout?: number | undefined;
173
173
  }
174
174
 
175
175
  interface CommonSpawnOptions extends CommonOptions, MessagingOptions, Abortable {
176
- argv0?: string;
177
- stdio?: StdioOptions;
178
- shell?: boolean | string;
179
- windowsVerbatimArguments?: boolean;
176
+ argv0?: string | undefined;
177
+ stdio?: StdioOptions | undefined;
178
+ shell?: boolean | string | undefined;
179
+ windowsVerbatimArguments?: boolean | undefined;
180
180
  }
181
181
 
182
182
  interface SpawnOptions extends CommonSpawnOptions {
183
- detached?: boolean;
183
+ detached?: boolean | undefined;
184
184
  }
185
185
 
186
186
  interface SpawnOptionsWithoutStdio extends SpawnOptions {
187
- stdio?: StdioPipeNamed | StdioPipe[];
187
+ stdio?: StdioPipeNamed | StdioPipe[] | undefined;
188
188
  }
189
189
 
190
190
  type StdioNull = 'inherit' | 'ignore' | Stream;
@@ -284,9 +284,9 @@ declare module 'child_process' {
284
284
  function spawn(command: string, args: ReadonlyArray<string>, options: SpawnOptions): ChildProcess;
285
285
 
286
286
  interface ExecOptions extends CommonOptions {
287
- shell?: string;
288
- maxBuffer?: number;
289
- killSignal?: NodeJS.Signals | number;
287
+ shell?: string | undefined;
288
+ maxBuffer?: number | undefined;
289
+ killSignal?: NodeJS.Signals | number | undefined;
290
290
  }
291
291
 
292
292
  interface ExecOptionsWithStringEncoding extends ExecOptions {
@@ -298,10 +298,10 @@ declare module 'child_process' {
298
298
  }
299
299
 
300
300
  interface ExecException extends Error {
301
- cmd?: string;
302
- killed?: boolean;
303
- code?: number;
304
- signal?: NodeJS.Signals;
301
+ cmd?: string | undefined;
302
+ killed?: boolean | undefined;
303
+ code?: number | undefined;
304
+ signal?: NodeJS.Signals | undefined;
305
305
  }
306
306
 
307
307
  // no `options` definitely means stdout/stderr are `string`.
@@ -345,11 +345,11 @@ declare module 'child_process' {
345
345
  }
346
346
 
347
347
  interface ExecFileOptions extends CommonOptions, Abortable {
348
- maxBuffer?: number;
349
- killSignal?: NodeJS.Signals | number;
350
- windowsVerbatimArguments?: boolean;
351
- shell?: boolean | string;
352
- signal?: AbortSignal;
348
+ maxBuffer?: number | undefined;
349
+ killSignal?: NodeJS.Signals | number | undefined;
350
+ windowsVerbatimArguments?: boolean | undefined;
351
+ shell?: boolean | string | undefined;
352
+ signal?: AbortSignal | undefined;
353
353
  }
354
354
  interface ExecFileOptionsWithStringEncoding extends ExecFileOptions {
355
355
  encoding: BufferEncoding;
@@ -450,26 +450,26 @@ declare module 'child_process' {
450
450
  }
451
451
 
452
452
  interface ForkOptions extends ProcessEnvOptions, MessagingOptions, Abortable {
453
- execPath?: string;
454
- execArgv?: string[];
455
- silent?: boolean;
456
- stdio?: StdioOptions;
457
- detached?: boolean;
458
- windowsVerbatimArguments?: boolean;
453
+ execPath?: string | undefined;
454
+ execArgv?: string[] | undefined;
455
+ silent?: boolean | undefined;
456
+ stdio?: StdioOptions | undefined;
457
+ detached?: boolean | undefined;
458
+ windowsVerbatimArguments?: boolean | undefined;
459
459
  }
460
460
  function fork(modulePath: string, options?: ForkOptions): ChildProcess;
461
461
  function fork(modulePath: string, args?: ReadonlyArray<string>, options?: ForkOptions): ChildProcess;
462
462
 
463
463
  interface SpawnSyncOptions extends CommonSpawnOptions {
464
- input?: string | NodeJS.ArrayBufferView;
465
- maxBuffer?: number;
466
- encoding?: BufferEncoding | 'buffer' | null;
464
+ input?: string | NodeJS.ArrayBufferView | undefined;
465
+ maxBuffer?: number | undefined;
466
+ encoding?: BufferEncoding | 'buffer' | null | undefined;
467
467
  }
468
468
  interface SpawnSyncOptionsWithStringEncoding extends SpawnSyncOptions {
469
469
  encoding: BufferEncoding;
470
470
  }
471
471
  interface SpawnSyncOptionsWithBufferEncoding extends SpawnSyncOptions {
472
- encoding?: 'buffer' | null;
472
+ encoding?: 'buffer' | null | undefined;
473
473
  }
474
474
  interface SpawnSyncReturns<T> {
475
475
  pid: number;
@@ -478,7 +478,7 @@ declare module 'child_process' {
478
478
  stderr: T;
479
479
  status: number | null;
480
480
  signal: NodeJS.Signals | null;
481
- error?: Error;
481
+ error?: Error | undefined;
482
482
  }
483
483
  function spawnSync(command: string): SpawnSyncReturns<Buffer>;
484
484
  function spawnSync(command: string, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
@@ -488,22 +488,22 @@ declare module 'child_process' {
488
488
  function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
489
489
  function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptions): SpawnSyncReturns<Buffer>;
490
490
 
491
- interface CommonExecOptions extends CommonOptions {
492
- input?: string | NodeJS.ArrayBufferView;
493
- stdio?: StdioOptions;
494
- killSignal?: NodeJS.Signals | number;
495
- maxBuffer?: number;
496
- encoding?: BufferEncoding | 'buffer' | null;
491
+ interface CommonExecOptions extends ProcessEnvOptions {
492
+ input?: string | NodeJS.ArrayBufferView | undefined;
493
+ stdio?: StdioOptions | undefined;
494
+ killSignal?: NodeJS.Signals | number | undefined;
495
+ maxBuffer?: number | undefined;
496
+ encoding?: BufferEncoding | 'buffer' | null | undefined;
497
497
  }
498
498
 
499
499
  interface ExecSyncOptions extends CommonExecOptions {
500
- shell?: string;
500
+ shell?: string | undefined;
501
501
  }
502
502
  interface ExecSyncOptionsWithStringEncoding extends ExecSyncOptions {
503
503
  encoding: BufferEncoding;
504
504
  }
505
505
  interface ExecSyncOptionsWithBufferEncoding extends ExecSyncOptions {
506
- encoding?: 'buffer' | null;
506
+ encoding?: 'buffer' | null | undefined;
507
507
  }
508
508
  function execSync(command: string): Buffer;
509
509
  function execSync(command: string, options?: ExecSyncOptionsWithStringEncoding): string;
@@ -511,7 +511,7 @@ declare module 'child_process' {
511
511
  function execSync(command: string, options?: ExecSyncOptions): Buffer;
512
512
 
513
513
  interface ExecFileSyncOptions extends CommonExecOptions {
514
- shell?: boolean | string;
514
+ shell?: boolean | string | undefined;
515
515
  }
516
516
  interface ExecFileSyncOptionsWithStringEncoding extends ExecFileSyncOptions {
517
517
  encoding: BufferEncoding;
@@ -527,3 +527,7 @@ declare module 'child_process' {
527
527
  function execFileSync(command: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptionsWithBufferEncoding): Buffer;
528
528
  function execFileSync(command: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptions): Buffer;
529
529
  }
530
+
531
+ declare module 'node:child_process' {
532
+ export * from 'child_process';
533
+ }
@@ -1,27 +1,27 @@
1
+ // Requires `esModuleInterop: true`
1
2
  declare module 'cluster' {
2
3
  import * as child from 'child_process';
3
4
  import EventEmitter = require('events');
4
5
  import * as net from 'net';
5
6
 
6
- // interfaces
7
- interface ClusterSettings {
8
- execArgv?: string[]; // default: process.execArgv
9
- exec?: string;
10
- args?: string[];
11
- silent?: boolean;
12
- stdio?: any[];
13
- uid?: number;
14
- gid?: number;
15
- inspectPort?: number | (() => number);
7
+ export interface ClusterSettings {
8
+ execArgv?: string[] | undefined; // default: process.execArgv
9
+ exec?: string | undefined;
10
+ args?: string[] | undefined;
11
+ silent?: boolean | undefined;
12
+ stdio?: any[] | undefined;
13
+ uid?: number | undefined;
14
+ gid?: number | undefined;
15
+ inspectPort?: number | (() => number) | undefined;
16
16
  }
17
17
 
18
- interface Address {
18
+ export interface Address {
19
19
  address: string;
20
20
  port: number;
21
21
  addressType: number | "udp4" | "udp6"; // 4, 6, -1, "udp4", "udp6"
22
22
  }
23
23
 
24
- class Worker extends EventEmitter {
24
+ export class Worker extends EventEmitter {
25
25
  id: number;
26
26
  process: child.ChildProcess;
27
27
  send(message: child.Serializable, sendHandle?: child.SendHandle, callback?: (error: Error | null) => void): boolean;
@@ -90,17 +90,23 @@ declare module 'cluster' {
90
90
  prependOnceListener(event: "online", listener: () => void): this;
91
91
  }
92
92
 
93
- interface Cluster extends EventEmitter {
94
- Worker: Worker;
93
+ export interface Cluster extends EventEmitter {
95
94
  disconnect(callback?: () => void): void;
96
95
  fork(env?: any): Worker;
97
- isMaster: boolean;
98
- isWorker: boolean;
96
+ /** @deprecated since v16.0.0 - use setupPrimary. */
97
+ readonly isMaster: boolean;
98
+ readonly isPrimary: boolean;
99
+ readonly isWorker: boolean;
99
100
  schedulingPolicy: number;
100
- settings: ClusterSettings;
101
+ readonly settings: ClusterSettings;
102
+ /** @deprecated since v16.0.0 - use setupPrimary. */
101
103
  setupMaster(settings?: ClusterSettings): void;
102
- worker?: Worker;
103
- workers?: NodeJS.Dict<Worker>;
104
+ /**
105
+ * `setupPrimary` is used to change the default 'fork' behavior. Once called, the settings will be present in cluster.settings.
106
+ */
107
+ setupPrimary(settings?: ClusterSettings): void;
108
+ readonly worker?: Worker | undefined;
109
+ readonly workers?: NodeJS.Dict<Worker> | undefined;
104
110
 
105
111
  readonly SCHED_NONE: number;
106
112
  readonly SCHED_RR: number;
@@ -147,7 +153,7 @@ declare module 'cluster' {
147
153
  once(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
148
154
  once(event: "fork", listener: (worker: Worker) => void): this;
149
155
  once(event: "listening", listener: (worker: Worker, address: Address) => void): this;
150
- once(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
156
+ once(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
151
157
  once(event: "online", listener: (worker: Worker) => void): this;
152
158
  once(event: "setup", listener: (settings: ClusterSettings) => void): this;
153
159
 
@@ -156,7 +162,8 @@ declare module 'cluster' {
156
162
  prependListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
157
163
  prependListener(event: "fork", listener: (worker: Worker) => void): this;
158
164
  prependListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
159
- prependListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
165
+ // the handle is a net.Socket or net.Server object, or undefined.
166
+ prependListener(event: "message", listener: (worker: Worker, message: any, handle?: net.Socket | net.Server) => void): this;
160
167
  prependListener(event: "online", listener: (worker: Worker) => void): this;
161
168
  prependListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
162
169
 
@@ -171,92 +178,10 @@ declare module 'cluster' {
171
178
  prependOnceListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
172
179
  }
173
180
 
174
- const SCHED_NONE: number;
175
- const SCHED_RR: number;
176
-
177
- function disconnect(callback?: () => void): void;
178
- function fork(env?: any): Worker;
179
- const isMaster: boolean;
180
- const isWorker: boolean;
181
- let schedulingPolicy: number;
182
- const settings: ClusterSettings;
183
- function setupMaster(settings?: ClusterSettings): void;
184
- const worker: Worker;
185
- const workers: NodeJS.Dict<Worker>;
186
-
187
- /**
188
- * events.EventEmitter
189
- * 1. disconnect
190
- * 2. exit
191
- * 3. fork
192
- * 4. listening
193
- * 5. message
194
- * 6. online
195
- * 7. setup
196
- */
197
- function addListener(event: string, listener: (...args: any[]) => void): Cluster;
198
- function addListener(event: "disconnect", listener: (worker: Worker) => void): Cluster;
199
- function addListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): Cluster;
200
- function addListener(event: "fork", listener: (worker: Worker) => void): Cluster;
201
- function addListener(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster;
202
- // the handle is a net.Socket or net.Server object, or undefined.
203
- function addListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster;
204
- function addListener(event: "online", listener: (worker: Worker) => void): Cluster;
205
- function addListener(event: "setup", listener: (settings: ClusterSettings) => void): Cluster;
206
-
207
- function emit(event: string | symbol, ...args: any[]): boolean;
208
- function emit(event: "disconnect", worker: Worker): boolean;
209
- function emit(event: "exit", worker: Worker, code: number, signal: string): boolean;
210
- function emit(event: "fork", worker: Worker): boolean;
211
- function emit(event: "listening", worker: Worker, address: Address): boolean;
212
- function emit(event: "message", worker: Worker, message: any, handle: net.Socket | net.Server): boolean;
213
- function emit(event: "online", worker: Worker): boolean;
214
- function emit(event: "setup", settings: ClusterSettings): boolean;
215
-
216
- function on(event: string, listener: (...args: any[]) => void): Cluster;
217
- function on(event: "disconnect", listener: (worker: Worker) => void): Cluster;
218
- function on(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): Cluster;
219
- function on(event: "fork", listener: (worker: Worker) => void): Cluster;
220
- function on(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster;
221
- function on(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster; // the handle is a net.Socket or net.Server object, or undefined.
222
- function on(event: "online", listener: (worker: Worker) => void): Cluster;
223
- function on(event: "setup", listener: (settings: ClusterSettings) => void): Cluster;
224
-
225
- function once(event: string, listener: (...args: any[]) => void): Cluster;
226
- function once(event: "disconnect", listener: (worker: Worker) => void): Cluster;
227
- function once(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): Cluster;
228
- function once(event: "fork", listener: (worker: Worker) => void): Cluster;
229
- function once(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster;
230
- function once(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster; // the handle is a net.Socket or net.Server object, or undefined.
231
- function once(event: "online", listener: (worker: Worker) => void): Cluster;
232
- function once(event: "setup", listener: (settings: ClusterSettings) => void): Cluster;
233
-
234
- function removeListener(event: string, listener: (...args: any[]) => void): Cluster;
235
- function removeAllListeners(event?: string): Cluster;
236
- function setMaxListeners(n: number): Cluster;
237
- function getMaxListeners(): number;
238
- function listeners(event: string): Function[];
239
- function listenerCount(type: string): number;
240
-
241
- function prependListener(event: string, listener: (...args: any[]) => void): Cluster;
242
- function prependListener(event: "disconnect", listener: (worker: Worker) => void): Cluster;
243
- function prependListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): Cluster;
244
- function prependListener(event: "fork", listener: (worker: Worker) => void): Cluster;
245
- function prependListener(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster;
246
- // the handle is a net.Socket or net.Server object, or undefined.
247
- function prependListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster;
248
- function prependListener(event: "online", listener: (worker: Worker) => void): Cluster;
249
- function prependListener(event: "setup", listener: (settings: ClusterSettings) => void): Cluster;
250
-
251
- function prependOnceListener(event: string, listener: (...args: any[]) => void): Cluster;
252
- function prependOnceListener(event: "disconnect", listener: (worker: Worker) => void): Cluster;
253
- function prependOnceListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): Cluster;
254
- function prependOnceListener(event: "fork", listener: (worker: Worker) => void): Cluster;
255
- function prependOnceListener(event: "listening", listener: (worker: Worker, address: Address) => void): Cluster;
256
- // the handle is a net.Socket or net.Server object, or undefined.
257
- function prependOnceListener(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): Cluster;
258
- function prependOnceListener(event: "online", listener: (worker: Worker) => void): Cluster;
259
- function prependOnceListener(event: "setup", listener: (settings: ClusterSettings) => void): Cluster;
181
+ const cluster: Cluster;
182
+ export default cluster;
183
+ }
260
184
 
261
- function eventNames(): string[];
185
+ declare module 'node:cluster' {
186
+ export * from 'cluster';
262
187
  }
@@ -4,7 +4,7 @@ declare module 'console' {
4
4
  global {
5
5
  // This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build
6
6
  interface Console {
7
- Console: NodeJS.ConsoleConstructor;
7
+ Console: console.ConsoleConstructor;
8
8
  /**
9
9
  * A simple assertion test that verifies whether `value` is truthy.
10
10
  * If it is not, an `AssertionError` is thrown.
@@ -25,16 +25,16 @@ declare module 'console' {
25
25
  */
26
26
  countReset(label?: string): void;
27
27
  /**
28
- * The `console.debug()` function is an alias for {@link console.log()}.
28
+ * The `console.debug()` function is an alias for {@link console.log}.
29
29
  */
30
30
  debug(message?: any, ...optionalParams: any[]): void;
31
31
  /**
32
- * Uses {@link util.inspect()} on `obj` and prints the resulting string to `stdout`.
32
+ * Uses {@link util.inspect} on `obj` and prints the resulting string to `stdout`.
33
33
  * This function bypasses any custom `inspect()` function defined on `obj`.
34
34
  */
35
35
  dir(obj: any, options?: InspectOptions): void;
36
36
  /**
37
- * This method calls {@link console.log()} passing it the arguments received. Please note that this method does not produce any XML formatting
37
+ * This method calls {@link console.log} passing it the arguments received. Please note that this method does not produce any XML formatting
38
38
  */
39
39
  dirxml(...data: any[]): void;
40
40
  /**
@@ -47,7 +47,7 @@ declare module 'console' {
47
47
  */
48
48
  group(...label: any[]): void;
49
49
  /**
50
- * The `console.groupCollapsed()` function is an alias for {@link console.group()}.
50
+ * The `console.groupCollapsed()` function is an alias for {@link console.group}.
51
51
  */
52
52
  groupCollapsed(...label: any[]): void;
53
53
  /**
@@ -55,7 +55,7 @@ declare module 'console' {
55
55
  */
56
56
  groupEnd(): void;
57
57
  /**
58
- * The {@link console.info()} function is an alias for {@link console.log()}.
58
+ * The {@link console.info} function is an alias for {@link console.log}.
59
59
  */
60
60
  info(message?: any, ...optionalParams: any[]): void;
61
61
  /**
@@ -72,19 +72,19 @@ declare module 'console' {
72
72
  */
73
73
  time(label?: string): void;
74
74
  /**
75
- * Stops a timer that was previously started by calling {@link console.time()} and prints the result to `stdout`.
75
+ * Stops a timer that was previously started by calling {@link console.time} and prints the result to `stdout`.
76
76
  */
77
77
  timeEnd(label?: string): void;
78
78
  /**
79
- * For a timer that was previously started by calling {@link console.time()}, prints the elapsed time and other `data` arguments to `stdout`.
79
+ * For a timer that was previously started by calling {@link console.time}, prints the elapsed time and other `data` arguments to `stdout`.
80
80
  */
81
81
  timeLog(label?: string, ...data: any[]): void;
82
82
  /**
83
- * Prints to `stderr` the string 'Trace :', followed by the {@link util.format()} formatted message and stack trace to the current position in the code.
83
+ * Prints to `stderr` the string 'Trace :', followed by the {@link util.format} formatted message and stack trace to the current position in the code.
84
84
  */
85
85
  trace(message?: any, ...optionalParams: any[]): void;
86
86
  /**
87
- * The {@link console.warn()} function is an alias for {@link console.error()}.
87
+ * The {@link console.warn} function is an alias for {@link console.error}.
88
88
  */
89
89
  warn(message?: any, ...optionalParams: any[]): void;
90
90
 
@@ -106,28 +106,29 @@ declare module 'console' {
106
106
  timeStamp(label?: string): void;
107
107
  }
108
108
 
109
- var console: Console;
110
-
111
- namespace NodeJS {
109
+ namespace console {
112
110
  interface ConsoleConstructorOptions {
113
- stdout: WritableStream;
114
- stderr?: WritableStream;
115
- ignoreErrors?: boolean;
116
- colorMode?: boolean | 'auto';
117
- inspectOptions?: InspectOptions;
111
+ stdout: NodeJS.WritableStream;
112
+ stderr?: NodeJS.WritableStream | undefined;
113
+ ignoreErrors?: boolean | undefined;
114
+ colorMode?: boolean | 'auto' | undefined;
115
+ inspectOptions?: InspectOptions | undefined;
118
116
  }
119
117
 
120
118
  interface ConsoleConstructor {
121
119
  prototype: Console;
122
- new(stdout: WritableStream, stderr?: WritableStream, ignoreErrors?: boolean): Console;
120
+ new(stdout: NodeJS.WritableStream, stderr?: NodeJS.WritableStream, ignoreErrors?: boolean): Console;
123
121
  new(options: ConsoleConstructorOptions): Console;
124
122
  }
125
-
126
- interface Global {
127
- console: typeof console;
128
- }
129
123
  }
124
+
125
+ var console: Console;
130
126
  }
131
127
 
128
+ export = globalThis.console;
129
+ }
130
+
131
+ declare module 'node:console' {
132
+ import console = require('console');
132
133
  export = console;
133
134
  }
@@ -11,3 +11,8 @@ declare module 'constants' {
11
11
  typeof fsConstants;
12
12
  export = exp;
13
13
  }
14
+
15
+ declare module 'node:constants' {
16
+ import constants = require('constants');
17
+ export = constants;
18
+ }