@types/node 12.20.41 → 13.1.2

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 (64) hide show
  1. node v12.20/LICENSE → node/LICENSE +21 -21
  2. node/README.md +16 -0
  3. node/assert.d.ts +50 -0
  4. node/async_hooks.d.ts +132 -0
  5. node/base.d.ts +41 -0
  6. node v12.20/buffer.d.ts → node/buffer.d.ts +1 -1
  7. node v12.20/child_process.d.ts → node/child_process.d.ts +111 -113
  8. node v12.20/cluster.d.ts → node/cluster.d.ts +25 -19
  9. node/console.d.ts +3 -0
  10. node/constants.d.ts +8 -0
  11. node/crypto.d.ts +615 -0
  12. node v12.20/dgram.d.ts → node/dgram.d.ts +48 -25
  13. node v12.20/dns.d.ts → node/dns.d.ts +6 -12
  14. node v12.20/domain.d.ts → node/domain.d.ts +2 -2
  15. node/events.d.ts +40 -0
  16. node v12.20/fs.d.ts → node/fs.d.ts +162 -262
  17. node v12.20/globals.d.ts → node/globals.d.ts +104 -260
  18. node v12.20/http.d.ts → node/http.d.ts +102 -177
  19. node v12.20/http2.d.ts → node/http2.d.ts +82 -87
  20. node/https.d.ts +53 -0
  21. node/index.d.ts +83 -0
  22. node v12.20/inspector.d.ts → node/inspector.d.ts +153 -159
  23. node/module.d.ts +20 -0
  24. node v12.20/net.d.ts → node/net.d.ts +37 -47
  25. node/os.d.ts +231 -0
  26. node v12.20/package.json → node/package.json +45 -9
  27. node/path.d.ts +153 -0
  28. node v12.20/perf_hooks.d.ts → node/perf_hooks.d.ts +76 -31
  29. node v12.20/process.d.ts → node/process.d.ts +2 -2
  30. node/punycode.d.ts +12 -0
  31. node v12.20/querystring.d.ts → node/querystring.d.ts +5 -5
  32. node v12.20/readline.d.ts → node/readline.d.ts +16 -17
  33. node v12.20/repl.d.ts → node/repl.d.ts +24 -32
  34. node v12.20/stream.d.ts → node/stream.d.ts +33 -43
  35. node v12.20/string_decoder.d.ts → node/string_decoder.d.ts +1 -1
  36. node v12.20/timers.d.ts → node/timers.d.ts +1 -1
  37. node v12.20/tls.d.ts → node/tls.d.ts +54 -65
  38. node v12.20/trace_events.d.ts → node/trace_events.d.ts +1 -1
  39. node/ts3.2/fs.d.ts +33 -0
  40. node/ts3.2/globals.d.ts +19 -0
  41. node/ts3.2/index.d.ts +16 -0
  42. node/ts3.2/util.d.ts +9 -0
  43. node v12.20/tty.d.ts → node/tty.d.ts +3 -3
  44. node v12.20/url.d.ts → node/url.d.ts +17 -24
  45. node v12.20/util.d.ts → node/util.d.ts +22 -37
  46. node v12.20/v8.d.ts → node/v8.d.ts +2 -12
  47. node v12.20/vm.d.ts → node/vm.d.ts +22 -24
  48. node v12.20/worker_threads.d.ts → node/worker_threads.d.ts +39 -85
  49. node v12.20/zlib.d.ts → node/zlib.d.ts +134 -138
  50. node v12.20/README.md +0 -16
  51. node v12.20/assert.d.ts +0 -117
  52. node v12.20/async_hooks.d.ts +0 -246
  53. node v12.20/console.d.ts +0 -3
  54. node v12.20/constants.d.ts +0 -448
  55. node v12.20/crypto.d.ts +0 -1159
  56. node v12.20/events.d.ts +0 -47
  57. node v12.20/globals.global.d.ts +0 -1
  58. node v12.20/https.d.ts +0 -156
  59. node v12.20/index.d.ts +0 -91
  60. node v12.20/module.d.ts +0 -3
  61. node v12.20/os.d.ts +0 -263
  62. node v12.20/path.d.ts +0 -159
  63. node v12.20/punycode.d.ts +0 -75
  64. node v12.20/wasi.d.ts +0 -55
@@ -1,13 +1,16 @@
1
- declare module 'child_process' {
2
- import * as events from 'events';
3
- import * as net from 'net';
4
- import { Writable, Readable, Stream, Pipe } from 'stream';
1
+ declare module "child_process" {
2
+ import * as events from "events";
3
+ import * as net from "net";
4
+ import { Writable, Readable, Stream, Pipe } from "stream";
5
+
6
+ type Serializable = string | object | number | boolean;
7
+ type SendHandle = net.Socket | net.Server;
5
8
 
6
9
  interface ChildProcess extends events.EventEmitter {
7
10
  stdin: Writable | null;
8
11
  stdout: Readable | null;
9
12
  stderr: Readable | null;
10
- readonly channel?: Pipe | null | undefined;
13
+ readonly channel?: Pipe | null;
11
14
  readonly stdio: [
12
15
  Writable | null, // stdin
13
16
  Readable | null, // stdout
@@ -18,14 +21,10 @@ declare module 'child_process' {
18
21
  readonly killed: boolean;
19
22
  readonly pid: number;
20
23
  readonly connected: boolean;
21
- readonly exitCode: number | null;
22
- readonly signalCode: number | null;
23
- readonly spawnargs: string[];
24
- readonly spawnfile: string;
25
- kill(signal?: NodeJS.Signals | number): boolean;
26
- send(message: any, callback?: (error: Error | null) => void): boolean;
27
- send(message: any, sendHandle?: net.Socket | net.Server, callback?: (error: Error | null) => void): boolean;
28
- send(message: any, sendHandle?: net.Socket | net.Server, options?: MessageOptions, callback?: (error: Error | null) => void): boolean;
24
+ kill(signal?: NodeJS.Signals | number): void;
25
+ send(message: Serializable, callback?: (error: Error | null) => void): boolean;
26
+ send(message: Serializable, sendHandle?: SendHandle, callback?: (error: Error | null) => void): boolean;
27
+ send(message: Serializable, sendHandle?: SendHandle, options?: MessageOptions, callback?: (error: Error | null) => void): boolean;
29
28
  disconnect(): void;
30
29
  unref(): void;
31
30
  ref(): void;
@@ -44,42 +43,42 @@ declare module 'child_process' {
44
43
  addListener(event: "disconnect", listener: () => void): this;
45
44
  addListener(event: "error", listener: (err: Error) => void): this;
46
45
  addListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
47
- addListener(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this;
46
+ addListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
48
47
 
49
48
  emit(event: string | symbol, ...args: any[]): boolean;
50
49
  emit(event: "close", code: number, signal: NodeJS.Signals): boolean;
51
50
  emit(event: "disconnect"): boolean;
52
51
  emit(event: "error", err: Error): boolean;
53
52
  emit(event: "exit", code: number | null, signal: NodeJS.Signals | null): boolean;
54
- emit(event: "message", message: any, sendHandle: net.Socket | net.Server): boolean;
53
+ emit(event: "message", message: Serializable, sendHandle: SendHandle): boolean;
55
54
 
56
55
  on(event: string, listener: (...args: any[]) => void): this;
57
56
  on(event: "close", listener: (code: number, signal: NodeJS.Signals) => void): this;
58
57
  on(event: "disconnect", listener: () => void): this;
59
58
  on(event: "error", listener: (err: Error) => void): this;
60
59
  on(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
61
- on(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this;
60
+ on(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
62
61
 
63
62
  once(event: string, listener: (...args: any[]) => void): this;
64
63
  once(event: "close", listener: (code: number, signal: NodeJS.Signals) => void): this;
65
64
  once(event: "disconnect", listener: () => void): this;
66
65
  once(event: "error", listener: (err: Error) => void): this;
67
66
  once(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
68
- once(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this;
67
+ once(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
69
68
 
70
69
  prependListener(event: string, listener: (...args: any[]) => void): this;
71
70
  prependListener(event: "close", listener: (code: number, signal: NodeJS.Signals) => void): this;
72
71
  prependListener(event: "disconnect", listener: () => void): this;
73
72
  prependListener(event: "error", listener: (err: Error) => void): this;
74
73
  prependListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
75
- prependListener(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this;
74
+ prependListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
76
75
 
77
76
  prependOnceListener(event: string, listener: (...args: any[]) => void): this;
78
77
  prependOnceListener(event: "close", listener: (code: number, signal: NodeJS.Signals) => void): this;
79
78
  prependOnceListener(event: "disconnect", listener: () => void): this;
80
79
  prependOnceListener(event: "error", listener: (err: Error) => void): this;
81
80
  prependOnceListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
82
- prependOnceListener(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this;
81
+ prependOnceListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
83
82
  }
84
83
 
85
84
  // return this object when stdio option is undefined or not specified
@@ -115,39 +114,52 @@ declare module 'child_process' {
115
114
  }
116
115
 
117
116
  interface MessageOptions {
118
- keepOpen?: boolean | undefined;
117
+ keepOpen?: boolean;
119
118
  }
120
119
 
121
120
  type StdioOptions = "pipe" | "ignore" | "inherit" | Array<("pipe" | "ipc" | "ignore" | "inherit" | Stream | number | null | undefined)>;
122
121
 
122
+ type SerializationType = 'json' | 'advanced';
123
+
124
+ interface MessagingOptions {
125
+ /**
126
+ * Specify the kind of serialization used for sending messages between processes.
127
+ * @default 'json'
128
+ */
129
+ serialization?: SerializationType;
130
+ }
131
+
123
132
  interface ProcessEnvOptions {
124
- uid?: number | undefined;
125
- gid?: number | undefined;
126
- cwd?: string | undefined;
127
- env?: NodeJS.ProcessEnv | undefined;
133
+ uid?: number;
134
+ gid?: number;
135
+ cwd?: string;
136
+ env?: NodeJS.ProcessEnv;
128
137
  }
129
138
 
130
139
  interface CommonOptions extends ProcessEnvOptions {
131
140
  /**
132
141
  * @default true
133
142
  */
134
- windowsHide?: boolean | undefined;
143
+ windowsHide?: boolean;
135
144
  /**
136
145
  * @default 0
137
146
  */
138
- timeout?: number | undefined;
147
+ timeout?: number;
148
+ }
149
+
150
+ interface CommonSpawnOptions extends CommonOptions, MessagingOptions {
151
+ argv0?: string;
152
+ stdio?: StdioOptions;
153
+ shell?: boolean | string;
154
+ windowsVerbatimArguments?: boolean;
139
155
  }
140
156
 
141
- interface SpawnOptions extends CommonOptions {
142
- argv0?: string | undefined;
143
- stdio?: StdioOptions | undefined;
144
- detached?: boolean | undefined;
145
- shell?: boolean | string | undefined;
146
- windowsVerbatimArguments?: boolean | undefined;
157
+ interface SpawnOptions extends CommonSpawnOptions {
158
+ detached?: boolean;
147
159
  }
148
160
 
149
161
  interface SpawnOptionsWithoutStdio extends SpawnOptions {
150
- stdio?: 'pipe' | Array<null | undefined | 'pipe'> | undefined;
162
+ stdio?: 'pipe' | Array<null | undefined | 'pipe'>;
151
163
  }
152
164
 
153
165
  type StdioNull = 'inherit' | 'ignore' | Stream;
@@ -246,9 +258,9 @@ declare module 'child_process' {
246
258
  function spawn(command: string, args: ReadonlyArray<string>, options: SpawnOptions): ChildProcess;
247
259
 
248
260
  interface ExecOptions extends CommonOptions {
249
- shell?: string | undefined;
250
- maxBuffer?: number | undefined;
251
- killSignal?: NodeJS.Signals | number | undefined;
261
+ shell?: string;
262
+ maxBuffer?: number;
263
+ killSignal?: NodeJS.Signals | number;
252
264
  }
253
265
 
254
266
  interface ExecOptionsWithStringEncoding extends ExecOptions {
@@ -260,10 +272,10 @@ declare module 'child_process' {
260
272
  }
261
273
 
262
274
  interface ExecException extends Error {
263
- cmd?: string | undefined;
264
- killed?: boolean | undefined;
265
- code?: number | undefined;
266
- signal?: NodeJS.Signals | undefined;
275
+ cmd?: string;
276
+ killed?: boolean;
277
+ code?: number;
278
+ signal?: NodeJS.Signals;
267
279
  }
268
280
 
269
281
  // no `options` definitely means stdout/stderr are `string`.
@@ -285,7 +297,7 @@ declare module 'child_process' {
285
297
  // fallback if nothing else matches. Worst case is always `string | Buffer`.
286
298
  function exec(
287
299
  command: string,
288
- options: ({ encoding?: string | null | undefined } & ExecOptions) | undefined | null,
300
+ options: ({ encoding?: string | null } & ExecOptions) | undefined | null,
289
301
  callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
290
302
  ): ChildProcess;
291
303
 
@@ -299,14 +311,14 @@ declare module 'child_process' {
299
311
  function __promisify__(command: string, options: { encoding: "buffer" | null } & ExecOptions): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
300
312
  function __promisify__(command: string, options: { encoding: BufferEncoding } & ExecOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
301
313
  function __promisify__(command: string, options: ExecOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
302
- function __promisify__(command: string, options?: ({ encoding?: string | null | undefined } & ExecOptions) | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
314
+ function __promisify__(command: string, options?: ({ encoding?: string | null } & ExecOptions) | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
303
315
  }
304
316
 
305
317
  interface ExecFileOptions extends CommonOptions {
306
- maxBuffer?: number | undefined;
307
- killSignal?: NodeJS.Signals | number | undefined;
308
- windowsVerbatimArguments?: boolean | undefined;
309
- shell?: boolean | string | undefined;
318
+ maxBuffer?: number;
319
+ killSignal?: NodeJS.Signals | number;
320
+ windowsVerbatimArguments?: boolean;
321
+ shell?: boolean | string;
310
322
  }
311
323
  interface ExecFileOptionsWithStringEncoding extends ExecFileOptions {
312
324
  encoding: BufferEncoding;
@@ -319,9 +331,9 @@ declare module 'child_process' {
319
331
  }
320
332
 
321
333
  function execFile(file: string): ChildProcess;
322
- function execFile(file: string, options: ({ encoding?: string | null | undefined } & ExecFileOptions) | undefined | null): ChildProcess;
334
+ function execFile(file: string, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): ChildProcess;
323
335
  function execFile(file: string, args?: ReadonlyArray<string> | null): ChildProcess;
324
- function execFile(file: string, args: ReadonlyArray<string> | undefined | null, options: ({ encoding?: string | null | undefined } & ExecFileOptions) | undefined | null): ChildProcess;
336
+ function execFile(file: string, args: ReadonlyArray<string> | undefined | null, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): ChildProcess;
325
337
 
326
338
  // no `options` definitely means stdout/stderr are `string`.
327
339
  function execFile(file: string, callback: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
@@ -371,63 +383,51 @@ declare module 'child_process' {
371
383
  // fallback if nothing else matches. Worst case is always `string | Buffer`.
372
384
  function execFile(
373
385
  file: string,
374
- options: ({ encoding?: string | null | undefined } & ExecFileOptions) | undefined | null,
386
+ options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null,
375
387
  callback: ((error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null,
376
388
  ): ChildProcess;
377
389
  function execFile(
378
390
  file: string,
379
391
  args: ReadonlyArray<string> | undefined | null,
380
- options: ({ encoding?: string | null | undefined } & ExecFileOptions) | undefined | null,
392
+ options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null,
381
393
  callback: ((error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null,
382
394
  ): ChildProcess;
383
395
 
384
396
  // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
385
397
  namespace execFile {
386
398
  function __promisify__(file: string): PromiseWithChild<{ stdout: string, stderr: string }>;
387
- function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null): PromiseWithChild<{ stdout: string, stderr: string }>;
399
+ function __promisify__(file: string, args: string[] | undefined | null): PromiseWithChild<{ stdout: string, stderr: string }>;
388
400
  function __promisify__(file: string, options: ExecFileOptionsWithBufferEncoding): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
389
- function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null, options: ExecFileOptionsWithBufferEncoding): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
401
+ function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithBufferEncoding): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
390
402
  function __promisify__(file: string, options: ExecFileOptionsWithStringEncoding): PromiseWithChild<{ stdout: string, stderr: string }>;
391
- function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null, options: ExecFileOptionsWithStringEncoding): PromiseWithChild<{ stdout: string, stderr: string }>;
403
+ function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithStringEncoding): PromiseWithChild<{ stdout: string, stderr: string }>;
392
404
  function __promisify__(file: string, options: ExecFileOptionsWithOtherEncoding): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
393
- function __promisify__(
394
- file: string,
395
- args: ReadonlyArray<string> | undefined | null,
396
- options: ExecFileOptionsWithOtherEncoding,
397
- ): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
405
+ function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithOtherEncoding): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
398
406
  function __promisify__(file: string, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
399
- function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
400
- function __promisify__(
401
- file: string,
402
- options: ({ encoding?: string | null | undefined } & ExecFileOptions) | undefined | null
403
- ): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
407
+ function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
408
+ function __promisify__(file: string, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
404
409
  function __promisify__(
405
410
  file: string,
406
- args: ReadonlyArray<string> | undefined | null,
407
- options: ({ encoding?: string | null | undefined } & ExecFileOptions) | undefined | null,
411
+ args: string[] | undefined | null,
412
+ options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null,
408
413
  ): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
409
414
  }
410
415
 
411
- interface ForkOptions extends ProcessEnvOptions {
412
- execPath?: string | undefined;
413
- execArgv?: string[] | undefined;
414
- silent?: boolean | undefined;
415
- stdio?: StdioOptions | undefined;
416
- detached?: boolean | undefined;
417
- windowsVerbatimArguments?: boolean | undefined;
416
+ interface ForkOptions extends ProcessEnvOptions, MessagingOptions {
417
+ execPath?: string;
418
+ execArgv?: string[];
419
+ silent?: boolean;
420
+ stdio?: StdioOptions;
421
+ detached?: boolean;
422
+ windowsVerbatimArguments?: boolean;
418
423
  }
419
- function fork(modulePath: string, options?: ForkOptions): ChildProcess;
420
424
  function fork(modulePath: string, args?: ReadonlyArray<string>, options?: ForkOptions): ChildProcess;
421
425
 
422
- interface SpawnSyncOptions extends CommonOptions {
423
- argv0?: string | undefined; // Not specified in the docs
424
- input?: string | NodeJS.ArrayBufferView | undefined;
425
- stdio?: StdioOptions | undefined;
426
- killSignal?: NodeJS.Signals | number | undefined;
427
- maxBuffer?: number | undefined;
428
- encoding?: string | undefined;
429
- shell?: boolean | string | undefined;
430
- windowsVerbatimArguments?: boolean | undefined;
426
+ interface SpawnSyncOptions extends CommonSpawnOptions {
427
+ input?: string | NodeJS.ArrayBufferView;
428
+ killSignal?: NodeJS.Signals | number;
429
+ maxBuffer?: number;
430
+ encoding?: string;
431
431
  }
432
432
  interface SpawnSyncOptionsWithStringEncoding extends SpawnSyncOptions {
433
433
  encoding: BufferEncoding;
@@ -437,29 +437,28 @@ declare module 'child_process' {
437
437
  }
438
438
  interface SpawnSyncReturns<T> {
439
439
  pid: number;
440
- output: Array<T | null>;
440
+ output: string[];
441
441
  stdout: T;
442
442
  stderr: T;
443
443
  status: number | null;
444
444
  signal: NodeJS.Signals | null;
445
- error?: Error | undefined;
445
+ error?: Error;
446
446
  }
447
447
  function spawnSync(command: string): SpawnSyncReturns<Buffer>;
448
- function spawnSync(command: string, options: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
449
- function spawnSync(command: string, options: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
450
- function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns<string | Buffer>;
451
- function spawnSync(command: string, args: ReadonlyArray<string>): SpawnSyncReturns<Buffer>;
452
- function spawnSync(command: string, args: ReadonlyArray<string>, options: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
453
- function spawnSync(command: string, args: ReadonlyArray<string>, options: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
454
- function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptions): SpawnSyncReturns<string | Buffer>;
448
+ function spawnSync(command: string, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
449
+ function spawnSync(command: string, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
450
+ function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns<Buffer>;
451
+ function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
452
+ function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
453
+ function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptions): SpawnSyncReturns<Buffer>;
455
454
 
456
455
  interface ExecSyncOptions extends CommonOptions {
457
- input?: string | Uint8Array | undefined;
458
- stdio?: StdioOptions | undefined;
459
- shell?: string | undefined;
460
- killSignal?: NodeJS.Signals | number | undefined;
461
- maxBuffer?: number | undefined;
462
- encoding?: string | undefined;
456
+ input?: string | Uint8Array;
457
+ stdio?: StdioOptions;
458
+ shell?: string;
459
+ killSignal?: NodeJS.Signals | number;
460
+ maxBuffer?: number;
461
+ encoding?: string;
463
462
  }
464
463
  interface ExecSyncOptionsWithStringEncoding extends ExecSyncOptions {
465
464
  encoding: BufferEncoding;
@@ -468,17 +467,17 @@ declare module 'child_process' {
468
467
  encoding: string; // specify `null`.
469
468
  }
470
469
  function execSync(command: string): Buffer;
471
- function execSync(command: string, options: ExecSyncOptionsWithStringEncoding): string;
472
- function execSync(command: string, options: ExecSyncOptionsWithBufferEncoding): Buffer;
473
- function execSync(command: string, options?: ExecSyncOptions): string | Buffer;
470
+ function execSync(command: string, options?: ExecSyncOptionsWithStringEncoding): string;
471
+ function execSync(command: string, options?: ExecSyncOptionsWithBufferEncoding): Buffer;
472
+ function execSync(command: string, options?: ExecSyncOptions): Buffer;
474
473
 
475
474
  interface ExecFileSyncOptions extends CommonOptions {
476
- input?: string | NodeJS.ArrayBufferView | undefined;
477
- stdio?: StdioOptions | undefined;
478
- killSignal?: NodeJS.Signals | number | undefined;
479
- maxBuffer?: number | undefined;
480
- encoding?: string | undefined;
481
- shell?: boolean | string | undefined;
475
+ input?: string | NodeJS.ArrayBufferView;
476
+ stdio?: StdioOptions;
477
+ killSignal?: NodeJS.Signals | number;
478
+ maxBuffer?: number;
479
+ encoding?: string;
480
+ shell?: boolean | string;
482
481
  }
483
482
  interface ExecFileSyncOptionsWithStringEncoding extends ExecFileSyncOptions {
484
483
  encoding: BufferEncoding;
@@ -487,11 +486,10 @@ declare module 'child_process' {
487
486
  encoding: string; // specify `null`.
488
487
  }
489
488
  function execFileSync(command: string): Buffer;
490
- function execFileSync(command: string, options: ExecFileSyncOptionsWithStringEncoding): string;
491
- function execFileSync(command: string, options: ExecFileSyncOptionsWithBufferEncoding): Buffer;
492
- function execFileSync(command: string, options?: ExecFileSyncOptions): string | Buffer;
493
- function execFileSync(command: string, args: ReadonlyArray<string>): Buffer;
494
- function execFileSync(command: string, args: ReadonlyArray<string>, options: ExecFileSyncOptionsWithStringEncoding): string;
495
- function execFileSync(command: string, args: ReadonlyArray<string>, options: ExecFileSyncOptionsWithBufferEncoding): Buffer;
496
- function execFileSync(command: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptions): string | Buffer;
489
+ function execFileSync(command: string, options?: ExecFileSyncOptionsWithStringEncoding): string;
490
+ function execFileSync(command: string, options?: ExecFileSyncOptionsWithBufferEncoding): Buffer;
491
+ function execFileSync(command: string, options?: ExecFileSyncOptions): Buffer;
492
+ function execFileSync(command: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptionsWithStringEncoding): string;
493
+ function execFileSync(command: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptionsWithBufferEncoding): Buffer;
494
+ function execFileSync(command: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptions): Buffer;
497
495
  }
@@ -1,18 +1,18 @@
1
- declare module 'cluster' {
2
- import * as child from 'child_process';
3
- import EventEmitter = require('events');
4
- import * as net from 'net';
1
+ declare module "cluster" {
2
+ import * as child from "child_process";
3
+ import * as events from "events";
4
+ import * as net from "net";
5
5
 
6
6
  // interfaces
7
7
  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;
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);
16
16
  }
17
17
 
18
18
  interface Address {
@@ -21,10 +21,10 @@ declare module 'cluster' {
21
21
  addressType: number | "udp4" | "udp6"; // 4, 6, -1, "udp4", "udp6"
22
22
  }
23
23
 
24
- class Worker extends EventEmitter {
24
+ class Worker extends events.EventEmitter {
25
25
  id: number;
26
26
  process: child.ChildProcess;
27
- send(message: any, sendHandle?: any, callback?: (error: Error | null) => void): boolean;
27
+ send(message: child.Serializable, sendHandle?: child.SendHandle, callback?: (error: Error | null) => void): boolean;
28
28
  kill(signal?: string): void;
29
29
  destroy(signal?: string): void;
30
30
  disconnect(): void;
@@ -90,19 +90,22 @@ declare module 'cluster' {
90
90
  prependOnceListener(event: "online", listener: () => void): this;
91
91
  }
92
92
 
93
- interface Cluster extends EventEmitter {
93
+ interface Cluster extends events.EventEmitter {
94
94
  Worker: Worker;
95
95
  disconnect(callback?: () => void): void;
96
96
  fork(env?: any): Worker;
97
97
  isMaster: boolean;
98
98
  isWorker: boolean;
99
- // TODO: cluster.schedulingPolicy
99
+ schedulingPolicy: number;
100
100
  settings: ClusterSettings;
101
101
  setupMaster(settings?: ClusterSettings): void;
102
- worker?: Worker | undefined;
102
+ worker?: Worker;
103
103
  workers?: {
104
104
  [index: string]: Worker | undefined
105
- } | undefined;
105
+ };
106
+
107
+ readonly SCHED_NONE: number;
108
+ readonly SCHED_RR: number;
106
109
 
107
110
  /**
108
111
  * events.EventEmitter
@@ -170,11 +173,14 @@ declare module 'cluster' {
170
173
  prependOnceListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
171
174
  }
172
175
 
176
+ const SCHED_NONE: number;
177
+ const SCHED_RR: number;
178
+
173
179
  function disconnect(callback?: () => void): void;
174
180
  function fork(env?: any): Worker;
175
181
  const isMaster: boolean;
176
182
  const isWorker: boolean;
177
- // TODO: cluster.schedulingPolicy
183
+ let schedulingPolicy: number;
178
184
  const settings: ClusterSettings;
179
185
  function setupMaster(settings?: ClusterSettings): void;
180
186
  const worker: Worker;
node/console.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ declare module "console" {
2
+ export = console;
3
+ }
node/constants.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ /** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */
2
+ declare module "constants" {
3
+ import { constants as osConstants, SignalConstants } from 'os';
4
+ import { constants as cryptoConstants } from 'crypto';
5
+ import { constants as fsConstants } from 'fs';
6
+ const exp: typeof osConstants.errno & typeof osConstants.priority & SignalConstants & typeof cryptoConstants & typeof fsConstants;
7
+ export = exp;
8
+ }