@types/node 12.20.15 → 12.20.19

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.
@@ -124,7 +124,7 @@ interface Console {
124
124
  }
125
125
 
126
126
  interface Error {
127
- stack?: string;
127
+ stack?: string | undefined;
128
128
  }
129
129
 
130
130
  // Declare "static" methods in Error
@@ -137,7 +137,7 @@ interface ErrorConstructor {
137
137
  *
138
138
  * @see https://github.com/v8/v8/wiki/Stack%20Trace%20API#customizing-stack-traces
139
139
  */
140
- prepareStackTrace?: (err: Error, stackTraces: NodeJS.CallSite[]) => any;
140
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
141
141
 
142
142
  stackTraceLimit: number;
143
143
  }
@@ -211,7 +211,7 @@ interface NodeRequire extends NodeRequireFunction {
211
211
  }
212
212
 
213
213
  interface RequireResolve {
214
- (id: string, options?: { paths?: string[]; }): string;
214
+ (id: string, options?: { paths?: string[] | undefined; }): string;
215
215
  paths(request: string): string[] | null;
216
216
  }
217
217
 
@@ -511,17 +511,17 @@ declare namespace NodeJS {
511
511
  * the getter function.
512
512
  * @default `false`
513
513
  */
514
- getters?: 'get' | 'set' | boolean;
515
- showHidden?: boolean;
514
+ getters?: 'get' | 'set' | boolean | undefined;
515
+ showHidden?: boolean | undefined;
516
516
  /**
517
517
  * @default 2
518
518
  */
519
- depth?: number | null;
520
- colors?: boolean;
521
- customInspect?: boolean;
522
- showProxy?: boolean;
523
- maxArrayLength?: number | null;
524
- breakLength?: number;
519
+ depth?: number | null | undefined;
520
+ colors?: boolean | undefined;
521
+ customInspect?: boolean | undefined;
522
+ showProxy?: boolean | undefined;
523
+ maxArrayLength?: number | null | undefined;
524
+ breakLength?: number | undefined;
525
525
  /**
526
526
  * Setting this to `false` causes each object key
527
527
  * to be displayed on a new line. It will also add new lines to text that is
@@ -532,16 +532,16 @@ declare namespace NodeJS {
532
532
  * For more information, see the example below.
533
533
  * @default `true`
534
534
  */
535
- compact?: boolean | number;
536
- sorted?: boolean | ((a: string, b: string) => number);
535
+ compact?: boolean | number | undefined;
536
+ sorted?: boolean | ((a: string, b: string) => number) | undefined;
537
537
  }
538
538
 
539
539
  interface ConsoleConstructorOptions {
540
540
  stdout: WritableStream;
541
- stderr?: WritableStream;
542
- ignoreErrors?: boolean;
543
- colorMode?: boolean | 'auto';
544
- inspectOptions?: InspectOptions;
541
+ stderr?: WritableStream | undefined;
542
+ ignoreErrors?: boolean | undefined;
543
+ colorMode?: boolean | 'auto' | undefined;
544
+ inspectOptions?: InspectOptions | undefined;
545
545
  }
546
546
 
547
547
  interface ConsoleConstructor {
@@ -625,11 +625,11 @@ declare namespace NodeJS {
625
625
  }
626
626
 
627
627
  interface ErrnoException extends Error {
628
- errno?: number;
629
- code?: string;
630
- path?: string;
631
- syscall?: string;
632
- stack?: string;
628
+ errno?: number | undefined;
629
+ code?: string | undefined;
630
+ path?: string | undefined;
631
+ syscall?: string | undefined;
632
+ stack?: string | undefined;
633
633
  }
634
634
 
635
635
  class EventEmitter {
@@ -658,7 +658,7 @@ declare namespace NodeJS {
658
658
  pause(): this;
659
659
  resume(): this;
660
660
  isPaused(): boolean;
661
- pipe<T extends WritableStream>(destination: T, options?: { end?: boolean; }): T;
661
+ pipe<T extends WritableStream>(destination: T, options?: { end?: boolean | undefined; }): T;
662
662
  unpipe(destination?: WritableStream): this;
663
663
  unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
664
664
  wrap(oldStream: ReadableStream): this;
@@ -704,10 +704,10 @@ declare namespace NodeJS {
704
704
 
705
705
  interface ProcessRelease {
706
706
  name: string;
707
- sourceUrl?: string;
708
- headersUrl?: string;
709
- libUrl?: string;
710
- lts?: string;
707
+ sourceUrl?: string | undefined;
708
+ headersUrl?: string | undefined;
709
+ libUrl?: string | undefined;
710
+ lts?: string | undefined;
711
711
  }
712
712
 
713
713
  interface ProcessVersions {
@@ -754,7 +754,7 @@ declare namespace NodeJS {
754
754
  type MultipleResolveListener = (type: MultipleResolveType, promise: Promise<any>, value: any) => void;
755
755
 
756
756
  interface Socket extends ReadWriteStream {
757
- isTTY?: true;
757
+ isTTY?: true | undefined;
758
758
  }
759
759
 
760
760
  interface ProcessEnv {
@@ -856,24 +856,24 @@ declare namespace NodeJS {
856
856
  *
857
857
  * @default 'Warning'
858
858
  */
859
- type?: string;
859
+ type?: string | undefined;
860
860
 
861
861
  /**
862
862
  * A unique identifier for the warning instance being emitted.
863
863
  */
864
- code?: string;
864
+ code?: string | undefined;
865
865
 
866
866
  /**
867
867
  * When `warning` is a `string`, `ctor` is an optional function used to limit the generated stack trace.
868
868
  *
869
869
  * @default process.emitWarning
870
870
  */
871
- ctor?: Function;
871
+ ctor?: Function | undefined;
872
872
 
873
873
  /**
874
874
  * Additional text to include with the error.
875
875
  */
876
- detail?: string;
876
+ detail?: string | undefined;
877
877
  }
878
878
 
879
879
  interface Process extends EventEmitter {
@@ -913,7 +913,7 @@ declare namespace NodeJS {
913
913
 
914
914
  env: ProcessEnv;
915
915
  exit(code?: number): never;
916
- exitCode?: number;
916
+ exitCode?: number | undefined;
917
917
  getgid(): number;
918
918
  setgid(id: number | string): void;
919
919
  getuid(): number;
@@ -960,7 +960,7 @@ declare namespace NodeJS {
960
960
  title: string;
961
961
  arch: string;
962
962
  platform: Platform;
963
- mainModule?: NodeModule;
963
+ mainModule?: NodeModule | undefined;
964
964
  memoryUsage(): MemoryUsage;
965
965
  cpuUsage(previousValue?: CpuUsage): CpuUsage;
966
966
  nextTick(callback: Function, ...args: any[]): void;
@@ -990,7 +990,7 @@ declare namespace NodeJS {
990
990
  domain: Domain;
991
991
 
992
992
  // Worker
993
- send?(message: any, sendHandle?: any, options?: { swallowErrors?: boolean}, callback?: (error: Error | null) => void): boolean;
993
+ send?(message: any, sendHandle?: any, options?: { swallowErrors?: boolean | undefined}, callback?: (error: Error | null) => void): boolean;
994
994
  disconnect(): void;
995
995
  connected: boolean;
996
996
 
@@ -1004,7 +1004,7 @@ declare namespace NodeJS {
1004
1004
  /**
1005
1005
  * Only available with `--experimental-report`
1006
1006
  */
1007
- report?: ProcessReport;
1007
+ report?: ProcessReport | undefined;
1008
1008
 
1009
1009
  resourceUsage(): ResourceUsage;
1010
1010
 
node v12.20/http.d.ts CHANGED
@@ -5,64 +5,64 @@ declare module 'http' {
5
5
 
6
6
  // incoming headers will never contain number
7
7
  interface IncomingHttpHeaders {
8
- 'accept'?: string;
9
- 'accept-language'?: string;
10
- 'accept-patch'?: string;
11
- 'accept-ranges'?: string;
12
- 'access-control-allow-credentials'?: string;
13
- 'access-control-allow-headers'?: string;
14
- 'access-control-allow-methods'?: string;
15
- 'access-control-allow-origin'?: string;
16
- 'access-control-expose-headers'?: string;
17
- 'access-control-max-age'?: string;
18
- 'access-control-request-headers'?: string;
19
- 'access-control-request-method'?: string;
20
- 'age'?: string;
21
- 'allow'?: string;
22
- 'alt-svc'?: string;
23
- 'authorization'?: string;
24
- 'cache-control'?: string;
25
- 'connection'?: string;
26
- 'content-disposition'?: string;
27
- 'content-encoding'?: string;
28
- 'content-language'?: string;
29
- 'content-length'?: string;
30
- 'content-location'?: string;
31
- 'content-range'?: string;
32
- 'content-type'?: string;
33
- 'cookie'?: string;
34
- 'date'?: string;
35
- 'etag'?: string;
36
- 'expect'?: string;
37
- 'expires'?: string;
38
- 'forwarded'?: string;
39
- 'from'?: string;
40
- 'host'?: string;
41
- 'if-match'?: string;
42
- 'if-modified-since'?: string;
43
- 'if-none-match'?: string;
44
- 'if-unmodified-since'?: string;
45
- 'last-modified'?: string;
46
- 'location'?: string;
47
- 'origin'?: string;
48
- 'pragma'?: string;
49
- 'proxy-authenticate'?: string;
50
- 'proxy-authorization'?: string;
51
- 'public-key-pins'?: string;
52
- 'range'?: string;
53
- 'referer'?: string;
54
- 'retry-after'?: string;
55
- 'set-cookie'?: string[];
56
- 'strict-transport-security'?: string;
57
- 'tk'?: string;
58
- 'trailer'?: string;
59
- 'transfer-encoding'?: string;
60
- 'upgrade'?: string;
61
- 'user-agent'?: string;
62
- 'vary'?: string;
63
- 'via'?: string;
64
- 'warning'?: string;
65
- 'www-authenticate'?: string;
8
+ 'accept'?: string | undefined;
9
+ 'accept-language'?: string | undefined;
10
+ 'accept-patch'?: string | undefined;
11
+ 'accept-ranges'?: string | undefined;
12
+ 'access-control-allow-credentials'?: string | undefined;
13
+ 'access-control-allow-headers'?: string | undefined;
14
+ 'access-control-allow-methods'?: string | undefined;
15
+ 'access-control-allow-origin'?: string | undefined;
16
+ 'access-control-expose-headers'?: string | undefined;
17
+ 'access-control-max-age'?: string | undefined;
18
+ 'access-control-request-headers'?: string | undefined;
19
+ 'access-control-request-method'?: string | undefined;
20
+ 'age'?: string | undefined;
21
+ 'allow'?: string | undefined;
22
+ 'alt-svc'?: string | undefined;
23
+ 'authorization'?: string | undefined;
24
+ 'cache-control'?: string | undefined;
25
+ 'connection'?: string | undefined;
26
+ 'content-disposition'?: string | undefined;
27
+ 'content-encoding'?: string | undefined;
28
+ 'content-language'?: string | undefined;
29
+ 'content-length'?: string | undefined;
30
+ 'content-location'?: string | undefined;
31
+ 'content-range'?: string | undefined;
32
+ 'content-type'?: string | undefined;
33
+ 'cookie'?: string | undefined;
34
+ 'date'?: string | undefined;
35
+ 'etag'?: string | undefined;
36
+ 'expect'?: string | undefined;
37
+ 'expires'?: string | undefined;
38
+ 'forwarded'?: string | undefined;
39
+ 'from'?: string | undefined;
40
+ 'host'?: string | undefined;
41
+ 'if-match'?: string | undefined;
42
+ 'if-modified-since'?: string | undefined;
43
+ 'if-none-match'?: string | undefined;
44
+ 'if-unmodified-since'?: string | undefined;
45
+ 'last-modified'?: string | undefined;
46
+ 'location'?: string | undefined;
47
+ 'origin'?: string | undefined;
48
+ 'pragma'?: string | undefined;
49
+ 'proxy-authenticate'?: string | undefined;
50
+ 'proxy-authorization'?: string | undefined;
51
+ 'public-key-pins'?: string | undefined;
52
+ 'range'?: string | undefined;
53
+ 'referer'?: string | undefined;
54
+ 'retry-after'?: string | undefined;
55
+ 'set-cookie'?: string[] | undefined;
56
+ 'strict-transport-security'?: string | undefined;
57
+ 'tk'?: string | undefined;
58
+ 'trailer'?: string | undefined;
59
+ 'transfer-encoding'?: string | undefined;
60
+ 'upgrade'?: string | undefined;
61
+ 'user-agent'?: string | undefined;
62
+ 'vary'?: string | undefined;
63
+ 'via'?: string | undefined;
64
+ 'warning'?: string | undefined;
65
+ 'www-authenticate'?: string | undefined;
66
66
  [header: string]: string | string[] | undefined;
67
67
  }
68
68
 
@@ -72,29 +72,29 @@ declare module 'http' {
72
72
  }
73
73
 
74
74
  interface ClientRequestArgs {
75
- protocol?: string | null;
76
- host?: string | null;
77
- hostname?: string | null;
78
- family?: number;
79
- port?: number | string | null;
80
- defaultPort?: number | string;
81
- localAddress?: string;
82
- socketPath?: string;
83
- method?: string;
84
- path?: string | null;
85
- headers?: OutgoingHttpHeaders;
86
- auth?: string | null;
87
- agent?: Agent | boolean;
88
- _defaultAgent?: Agent;
89
- timeout?: number;
90
- setHost?: boolean;
75
+ protocol?: string | null | undefined;
76
+ host?: string | null | undefined;
77
+ hostname?: string | null | undefined;
78
+ family?: number | undefined;
79
+ port?: number | string | null | undefined;
80
+ defaultPort?: number | string | undefined;
81
+ localAddress?: string | undefined;
82
+ socketPath?: string | undefined;
83
+ method?: string | undefined;
84
+ path?: string | null | undefined;
85
+ headers?: OutgoingHttpHeaders | undefined;
86
+ auth?: string | null | undefined;
87
+ agent?: Agent | boolean | undefined;
88
+ _defaultAgent?: Agent | undefined;
89
+ timeout?: number | undefined;
90
+ setHost?: boolean | undefined;
91
91
  // https://github.com/nodejs/node/blob/master/lib/_http_client.js#L278
92
- createConnection?: (options: ClientRequestArgs, oncreate: (err: Error, socket: Socket) => void) => Socket;
92
+ createConnection?: ((options: ClientRequestArgs, oncreate: (err: Error, socket: Socket) => void) => Socket) | undefined;
93
93
  }
94
94
 
95
95
  interface ServerOptions {
96
- IncomingMessage?: typeof IncomingMessage;
97
- ServerResponse?: typeof ServerResponse;
96
+ IncomingMessage?: typeof IncomingMessage | undefined;
97
+ ServerResponse?: typeof ServerResponse | undefined;
98
98
  }
99
99
 
100
100
  type RequestListener = (req: IncomingMessage, res: ServerResponse) => void;
@@ -119,6 +119,72 @@ declare module 'http' {
119
119
  */
120
120
  headersTimeout: number;
121
121
  keepAliveTimeout: number;
122
+ addListener(event: string, listener: (...args: any[]) => void): this;
123
+ addListener(event: 'close', listener: () => void): this;
124
+ addListener(event: 'connection', listener: (socket: Socket) => void): this;
125
+ addListener(event: 'error', listener: (err: Error) => void): this;
126
+ addListener(event: 'listening', listener: () => void): this;
127
+ addListener(event: 'checkContinue', listener: RequestListener): this;
128
+ addListener(event: 'checkExpectation', listener: RequestListener): this;
129
+ addListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
130
+ addListener(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
131
+ addListener(event: 'request', listener: RequestListener): this;
132
+ addListener(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
133
+ emit(event: string, ...args: any[]): boolean;
134
+ emit(event: 'close'): boolean;
135
+ emit(event: 'connection', socket: Socket): boolean;
136
+ emit(event: 'error', err: Error): boolean;
137
+ emit(event: 'listening'): boolean;
138
+ emit(event: 'checkContinue', req: IncomingMessage, res: ServerResponse): boolean;
139
+ emit(event: 'checkExpectation', req: IncomingMessage, res: ServerResponse): boolean;
140
+ emit(event: 'clientError', err: Error, socket: stream.Duplex): boolean;
141
+ emit(event: 'connect', req: IncomingMessage, socket: stream.Duplex, head: Buffer): boolean;
142
+ emit(event: 'request', req: IncomingMessage, res: ServerResponse): boolean;
143
+ emit(event: 'upgrade', req: IncomingMessage, socket: stream.Duplex, head: Buffer): boolean;
144
+ on(event: string, listener: (...args: any[]) => void): this;
145
+ on(event: 'close', listener: () => void): this;
146
+ on(event: 'connection', listener: (socket: Socket) => void): this;
147
+ on(event: 'error', listener: (err: Error) => void): this;
148
+ on(event: 'listening', listener: () => void): this;
149
+ on(event: 'checkContinue', listener: RequestListener): this;
150
+ on(event: 'checkExpectation', listener: RequestListener): this;
151
+ on(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
152
+ on(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
153
+ on(event: 'request', listener: RequestListener): this;
154
+ on(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
155
+ once(event: string, listener: (...args: any[]) => void): this;
156
+ once(event: 'close', listener: () => void): this;
157
+ once(event: 'connection', listener: (socket: Socket) => void): this;
158
+ once(event: 'error', listener: (err: Error) => void): this;
159
+ once(event: 'listening', listener: () => void): this;
160
+ once(event: 'checkContinue', listener: RequestListener): this;
161
+ once(event: 'checkExpectation', listener: RequestListener): this;
162
+ once(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
163
+ once(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
164
+ once(event: 'request', listener: RequestListener): this;
165
+ once(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
166
+ prependListener(event: string, listener: (...args: any[]) => void): this;
167
+ prependListener(event: 'close', listener: () => void): this;
168
+ prependListener(event: 'connection', listener: (socket: Socket) => void): this;
169
+ prependListener(event: 'error', listener: (err: Error) => void): this;
170
+ prependListener(event: 'listening', listener: () => void): this;
171
+ prependListener(event: 'checkContinue', listener: RequestListener): this;
172
+ prependListener(event: 'checkExpectation', listener: RequestListener): this;
173
+ prependListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
174
+ prependListener(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
175
+ prependListener(event: 'request', listener: RequestListener): this;
176
+ prependListener(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
177
+ prependOnceListener(event: string, listener: (...args: any[]) => void): this;
178
+ prependOnceListener(event: 'close', listener: () => void): this;
179
+ prependOnceListener(event: 'connection', listener: (socket: Socket) => void): this;
180
+ prependOnceListener(event: 'error', listener: (err: Error) => void): this;
181
+ prependOnceListener(event: 'listening', listener: () => void): this;
182
+ prependOnceListener(event: 'checkContinue', listener: RequestListener): this;
183
+ prependOnceListener(event: 'checkExpectation', listener: RequestListener): this;
184
+ prependOnceListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
185
+ prependOnceListener(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
186
+ prependOnceListener(event: 'request', listener: RequestListener): this;
187
+ prependOnceListener(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
122
188
  }
123
189
 
124
190
  // https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js
@@ -158,7 +224,7 @@ declare module 'http' {
158
224
  // https://github.com/nodejs/node/blob/master/test/parallel/test-http-write-callbacks.js#L53
159
225
  // no args in writeContinue callback
160
226
  writeContinue(callback?: () => void): void;
161
- writeHead(statusCode: number, reasonPhrase?: string, headers?: OutgoingHttpHeaders): this;
227
+ writeHead(statusCode: number, statusMessage?: string, headers?: OutgoingHttpHeaders): this;
162
228
  writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this;
163
229
  writeProcessing(): void;
164
230
  }
@@ -289,19 +355,19 @@ declare module 'http' {
289
355
  /**
290
356
  * Only valid for request obtained from http.Server.
291
357
  */
292
- method?: string;
358
+ method?: string | undefined;
293
359
  /**
294
360
  * Only valid for request obtained from http.Server.
295
361
  */
296
- url?: string;
362
+ url?: string | undefined;
297
363
  /**
298
364
  * Only valid for response obtained from http.ClientRequest.
299
365
  */
300
- statusCode?: number;
366
+ statusCode?: number | undefined;
301
367
  /**
302
368
  * Only valid for response obtained from http.ClientRequest.
303
369
  */
304
- statusMessage?: string;
370
+ statusMessage?: string | undefined;
305
371
  socket: Socket;
306
372
  destroy(error?: Error): void;
307
373
  }
@@ -310,32 +376,32 @@ declare module 'http' {
310
376
  /**
311
377
  * Keep sockets around in a pool to be used by other requests in the future. Default = false
312
378
  */
313
- keepAlive?: boolean;
379
+ keepAlive?: boolean | undefined;
314
380
  /**
315
381
  * When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000.
316
382
  * Only relevant if keepAlive is set to true.
317
383
  */
318
- keepAliveMsecs?: number;
384
+ keepAliveMsecs?: number | undefined;
319
385
  /**
320
386
  * Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity
321
387
  */
322
- maxSockets?: number;
388
+ maxSockets?: number | undefined;
323
389
  /**
324
390
  * Maximum number of sockets allowed for all hosts in total. Each request will use a new socket until the maximum is reached. Default: Infinity.
325
391
  */
326
- maxTotalSockets?: number;
392
+ maxTotalSockets?: number | undefined;
327
393
  /**
328
394
  * Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256.
329
395
  */
330
- maxFreeSockets?: number;
396
+ maxFreeSockets?: number | undefined;
331
397
  /**
332
398
  * Socket timeout in milliseconds. This will set the timeout after the socket is connected.
333
399
  */
334
- timeout?: number;
400
+ timeout?: number | undefined;
335
401
  /**
336
402
  * Scheduling strategy to apply when picking the next free socket to use. Default: 'fifo'.
337
403
  */
338
- scheduling?: 'fifo' | 'lifo';
404
+ scheduling?: 'fifo' | 'lifo' | undefined;
339
405
  }
340
406
 
341
407
  class Agent {