@types/node 15.14.9 → 16.0.0

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 +32 -27
  5. node v15.14/async_hooks.d.ts → node/async_hooks.d.ts +5 -1
  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 +6 -2
  9. node v15.14/cluster.d.ts → node/cluster.d.ts +25 -100
  10. node v15.14/console.d.ts → node/console.d.ts +21 -20
  11. node v15.14/constants.d.ts → node/constants.d.ts +5 -0
  12. node v15.14/crypto.d.ts → node/crypto.d.ts +21 -6
  13. node v15.14/dgram.d.ts → node/dgram.d.ts +4 -0
  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 +4 -0
  17. node/domain.d.ts +25 -0
  18. node v15.14/events.d.ts → node/events.d.ts +5 -0
  19. node v15.14/fs/promises.d.ts → node/fs/promises.d.ts +4 -0
  20. node v15.14/fs.d.ts → node/fs.d.ts +12 -20
  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 +12 -70
  24. node v15.14/http2.d.ts → node/http2.d.ts +4 -1
  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 +4 -322
  28. node v15.14/module.d.ts → node/module.d.ts +25 -4
  29. node v15.14/net.d.ts → node/net.d.ts +4 -6
  30. node v15.14/os.d.ts → node/os.d.ts +4 -0
  31. node v15.14/package.json → node/package.json +3 -3
  32. node v15.14/path.d.ts → node/path.d.ts +5 -0
  33. node v15.14/perf_hooks.d.ts → node/perf_hooks.d.ts +66 -19
  34. node v15.14/process.d.ts → node/process.d.ts +42 -40
  35. node v15.14/punycode.d.ts → node/punycode.d.ts +4 -0
  36. node v15.14/querystring.d.ts → node/querystring.d.ts +4 -0
  37. node v15.14/readline.d.ts → node/readline.d.ts +5 -1
  38. node v15.14/repl.d.ts → node/repl.d.ts +4 -0
  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 +5 -0
  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 +4 -0
  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 +4 -0
  51. node/util/types.d.ts +57 -0
  52. node v15.14/util.d.ts → node/util.d.ts +65 -19
  53. node v15.14/v8.d.ts → node/v8.d.ts +4 -0
  54. node v15.14/vm.d.ts → node/vm.d.ts +4 -0
  55. node v15.14/wasi.d.ts → node/wasi.d.ts +4 -0
  56. node v15.14/worker_threads.d.ts → node/worker_threads.d.ts +4 -0
  57. node v15.14/zlib.d.ts → node/zlib.d.ts +4 -0
  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
node/globals.d.ts ADDED
@@ -0,0 +1,274 @@
1
+ // Declare "static" methods in Error
2
+ interface ErrorConstructor {
3
+ /** Create .stack property on a target object */
4
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
5
+
6
+ /**
7
+ * Optional override for formatting stack traces
8
+ *
9
+ * @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces
10
+ */
11
+ prepareStackTrace?: (err: Error, stackTraces: NodeJS.CallSite[]) => any;
12
+
13
+ stackTraceLimit: number;
14
+ }
15
+
16
+ // Node.js ESNEXT support
17
+ interface String {
18
+ /** Removes whitespace from the left end of a string. */
19
+ trimLeft(): string;
20
+ /** Removes whitespace from the right end of a string. */
21
+ trimRight(): string;
22
+
23
+ /** Returns a copy with leading whitespace removed. */
24
+ trimStart(): string;
25
+ /** Returns a copy with trailing whitespace removed. */
26
+ trimEnd(): string;
27
+ }
28
+
29
+ /*-----------------------------------------------*
30
+ * *
31
+ * GLOBAL *
32
+ * *
33
+ ------------------------------------------------*/
34
+
35
+ // For backwards compability
36
+ interface NodeRequire extends NodeJS.Require { }
37
+ interface RequireResolve extends NodeJS.RequireResolve { }
38
+ interface NodeModule extends NodeJS.Module { }
39
+
40
+ declare var process: NodeJS.Process;
41
+ declare var console: Console;
42
+
43
+ declare var __filename: string;
44
+ declare var __dirname: string;
45
+
46
+ declare var require: NodeRequire;
47
+ declare var module: NodeModule;
48
+
49
+ // Same as module.exports
50
+ declare var exports: any;
51
+
52
+ /**
53
+ * Only available if `--expose-gc` is passed to the process.
54
+ */
55
+ declare var gc: undefined | (() => void);
56
+
57
+ //#region borrowed
58
+ // from https://github.com/microsoft/TypeScript/blob/38da7c600c83e7b31193a62495239a0fe478cb67/lib/lib.webworker.d.ts#L633 until moved to separate lib
59
+ /** A controller object that allows you to abort one or more DOM requests as and when desired. */
60
+ interface AbortController {
61
+ /**
62
+ * Returns the AbortSignal object associated with this object.
63
+ */
64
+
65
+ readonly signal: AbortSignal;
66
+ /**
67
+ * Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted.
68
+ */
69
+ abort(): void;
70
+ }
71
+
72
+ /** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */
73
+ interface AbortSignal {
74
+ /**
75
+ * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise.
76
+ */
77
+ readonly aborted: boolean;
78
+ }
79
+
80
+ declare var AbortController: {
81
+ prototype: AbortController;
82
+ new(): AbortController;
83
+ };
84
+
85
+ declare var AbortSignal: {
86
+ prototype: AbortSignal;
87
+ new(): AbortSignal;
88
+ // TODO: Add abort() static
89
+ };
90
+ //#endregion borrowed
91
+
92
+ /*----------------------------------------------*
93
+ * *
94
+ * GLOBAL INTERFACES *
95
+ * *
96
+ *-----------------------------------------------*/
97
+ declare namespace NodeJS {
98
+ interface CallSite {
99
+ /**
100
+ * Value of "this"
101
+ */
102
+ getThis(): unknown;
103
+
104
+ /**
105
+ * Type of "this" as a string.
106
+ * This is the name of the function stored in the constructor field of
107
+ * "this", if available. Otherwise the object's [[Class]] internal
108
+ * property.
109
+ */
110
+ getTypeName(): string | null;
111
+
112
+ /**
113
+ * Current function
114
+ */
115
+ getFunction(): Function | undefined;
116
+
117
+ /**
118
+ * Name of the current function, typically its name property.
119
+ * If a name property is not available an attempt will be made to try
120
+ * to infer a name from the function's context.
121
+ */
122
+ getFunctionName(): string | null;
123
+
124
+ /**
125
+ * Name of the property [of "this" or one of its prototypes] that holds
126
+ * the current function
127
+ */
128
+ getMethodName(): string | null;
129
+
130
+ /**
131
+ * Name of the script [if this function was defined in a script]
132
+ */
133
+ getFileName(): string | null;
134
+
135
+ /**
136
+ * Current line number [if this function was defined in a script]
137
+ */
138
+ getLineNumber(): number | null;
139
+
140
+ /**
141
+ * Current column number [if this function was defined in a script]
142
+ */
143
+ getColumnNumber(): number | null;
144
+
145
+ /**
146
+ * A call site object representing the location where eval was called
147
+ * [if this function was created using a call to eval]
148
+ */
149
+ getEvalOrigin(): string | undefined;
150
+
151
+ /**
152
+ * Is this a toplevel invocation, that is, is "this" the global object?
153
+ */
154
+ isToplevel(): boolean;
155
+
156
+ /**
157
+ * Does this call take place in code defined by a call to eval?
158
+ */
159
+ isEval(): boolean;
160
+
161
+ /**
162
+ * Is this call in native V8 code?
163
+ */
164
+ isNative(): boolean;
165
+
166
+ /**
167
+ * Is this a constructor call?
168
+ */
169
+ isConstructor(): boolean;
170
+ }
171
+
172
+ interface ErrnoException extends Error {
173
+ errno?: number;
174
+ code?: string;
175
+ path?: string;
176
+ syscall?: string;
177
+ stack?: string;
178
+ }
179
+
180
+ interface ReadableStream extends EventEmitter {
181
+ readable: boolean;
182
+ read(size?: number): string | Buffer;
183
+ setEncoding(encoding: BufferEncoding): this;
184
+ pause(): this;
185
+ resume(): this;
186
+ isPaused(): boolean;
187
+ pipe<T extends WritableStream>(destination: T, options?: { end?: boolean; }): T;
188
+ unpipe(destination?: WritableStream): this;
189
+ unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
190
+ wrap(oldStream: ReadableStream): this;
191
+ [Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
192
+ }
193
+
194
+ interface WritableStream extends EventEmitter {
195
+ writable: boolean;
196
+ write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
197
+ write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
198
+ end(cb?: () => void): void;
199
+ end(data: string | Uint8Array, cb?: () => void): void;
200
+ end(str: string, encoding?: BufferEncoding, cb?: () => void): void;
201
+ }
202
+
203
+ interface ReadWriteStream extends ReadableStream, WritableStream { }
204
+
205
+ interface RefCounted {
206
+ ref(): this;
207
+ unref(): this;
208
+ }
209
+
210
+ type TypedArray =
211
+ | Uint8Array
212
+ | Uint8ClampedArray
213
+ | Uint16Array
214
+ | Uint32Array
215
+ | Int8Array
216
+ | Int16Array
217
+ | Int32Array
218
+ | BigUint64Array
219
+ | BigInt64Array
220
+ | Float32Array
221
+ | Float64Array;
222
+ type ArrayBufferView = TypedArray | DataView;
223
+
224
+ interface Require {
225
+ (id: string): any;
226
+ resolve: RequireResolve;
227
+ cache: Dict<NodeModule>;
228
+ /**
229
+ * @deprecated
230
+ */
231
+ extensions: RequireExtensions;
232
+ main: Module | undefined;
233
+ }
234
+
235
+ interface RequireResolve {
236
+ (id: string, options?: { paths?: string[]; }): string;
237
+ paths(request: string): string[] | null;
238
+ }
239
+
240
+ interface RequireExtensions extends Dict<(m: Module, filename: string) => any> {
241
+ '.js': (m: Module, filename: string) => any;
242
+ '.json': (m: Module, filename: string) => any;
243
+ '.node': (m: Module, filename: string) => any;
244
+ }
245
+ interface Module {
246
+ /**
247
+ * `true` if the module is running during the Node.js preload
248
+ */
249
+ isPreloading: boolean;
250
+ exports: any;
251
+ require: Require;
252
+ id: string;
253
+ filename: string;
254
+ loaded: boolean;
255
+ /** @deprecated since 14.6.0 Please use `require.main` and `module.children` instead. */
256
+ parent: Module | null | undefined;
257
+ children: Module[];
258
+ /**
259
+ * @since 11.14.0
260
+ *
261
+ * The directory name of the module. This is usually the same as the path.dirname() of the module.id.
262
+ */
263
+ path: string;
264
+ paths: string[];
265
+ }
266
+
267
+ interface Dict<T> {
268
+ [key: string]: T | undefined;
269
+ }
270
+
271
+ interface ReadOnlyDict<T> {
272
+ readonly [key: string]: T | undefined;
273
+ }
274
+ }
@@ -0,0 +1 @@
1
+ declare var global: typeof globalThis;
@@ -123,9 +123,7 @@ declare module 'http' {
123
123
 
124
124
  type RequestListener = (req: IncomingMessage, res: ServerResponse) => void;
125
125
 
126
- class Server extends NetServer {
127
- constructor(requestListener?: RequestListener);
128
- constructor(options: ServerOptions, requestListener?: RequestListener);
126
+ interface HttpBase {
129
127
  setTimeout(msecs?: number, callback?: () => void): this;
130
128
  setTimeout(callback: () => void): this;
131
129
  /**
@@ -148,72 +146,12 @@ declare module 'http' {
148
146
  * {@link https://nodejs.org/api/http.html#http_server_requesttimeout}
149
147
  */
150
148
  requestTimeout: number;
151
- addListener(event: string, listener: (...args: any[]) => void): this;
152
- addListener(event: 'close', listener: () => void): this;
153
- addListener(event: 'connection', listener: (socket: Socket) => void): this;
154
- addListener(event: 'error', listener: (err: Error) => void): this;
155
- addListener(event: 'listening', listener: () => void): this;
156
- addListener(event: 'checkContinue', listener: RequestListener): this;
157
- addListener(event: 'checkExpectation', listener: RequestListener): this;
158
- addListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
159
- addListener(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
160
- addListener(event: 'request', listener: RequestListener): this;
161
- addListener(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
162
- emit(event: string, ...args: any[]): boolean;
163
- emit(event: 'close'): boolean;
164
- emit(event: 'connection', socket: Socket): boolean;
165
- emit(event: 'error', err: Error): boolean;
166
- emit(event: 'listening'): boolean;
167
- emit(event: 'checkContinue', req: IncomingMessage, res: ServerResponse): boolean;
168
- emit(event: 'checkExpectation', req: IncomingMessage, res: ServerResponse): boolean;
169
- emit(event: 'clientError', err: Error, socket: stream.Duplex): boolean;
170
- emit(event: 'connect', req: IncomingMessage, socket: stream.Duplex, head: Buffer): boolean;
171
- emit(event: 'request', req: IncomingMessage, res: ServerResponse): boolean;
172
- emit(event: 'upgrade', req: IncomingMessage, socket: stream.Duplex, head: Buffer): boolean;
173
- on(event: string, listener: (...args: any[]) => void): this;
174
- on(event: 'close', listener: () => void): this;
175
- on(event: 'connection', listener: (socket: Socket) => void): this;
176
- on(event: 'error', listener: (err: Error) => void): this;
177
- on(event: 'listening', listener: () => void): this;
178
- on(event: 'checkContinue', listener: RequestListener): this;
179
- on(event: 'checkExpectation', listener: RequestListener): this;
180
- on(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
181
- on(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
182
- on(event: 'request', listener: RequestListener): this;
183
- on(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
184
- once(event: string, listener: (...args: any[]) => void): this;
185
- once(event: 'close', listener: () => void): this;
186
- once(event: 'connection', listener: (socket: Socket) => void): this;
187
- once(event: 'error', listener: (err: Error) => void): this;
188
- once(event: 'listening', listener: () => void): this;
189
- once(event: 'checkContinue', listener: RequestListener): this;
190
- once(event: 'checkExpectation', listener: RequestListener): this;
191
- once(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
192
- once(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
193
- once(event: 'request', listener: RequestListener): this;
194
- once(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
195
- prependListener(event: string, listener: (...args: any[]) => void): this;
196
- prependListener(event: 'close', listener: () => void): this;
197
- prependListener(event: 'connection', listener: (socket: Socket) => void): this;
198
- prependListener(event: 'error', listener: (err: Error) => void): this;
199
- prependListener(event: 'listening', listener: () => void): this;
200
- prependListener(event: 'checkContinue', listener: RequestListener): this;
201
- prependListener(event: 'checkExpectation', listener: RequestListener): this;
202
- prependListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
203
- prependListener(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
204
- prependListener(event: 'request', listener: RequestListener): this;
205
- prependListener(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
206
- prependOnceListener(event: string, listener: (...args: any[]) => void): this;
207
- prependOnceListener(event: 'close', listener: () => void): this;
208
- prependOnceListener(event: 'connection', listener: (socket: Socket) => void): this;
209
- prependOnceListener(event: 'error', listener: (err: Error) => void): this;
210
- prependOnceListener(event: 'listening', listener: () => void): this;
211
- prependOnceListener(event: 'checkContinue', listener: RequestListener): this;
212
- prependOnceListener(event: 'checkExpectation', listener: RequestListener): this;
213
- prependOnceListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
214
- prependOnceListener(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
215
- prependOnceListener(event: 'request', listener: RequestListener): this;
216
- prependOnceListener(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
149
+ }
150
+
151
+ interface Server extends HttpBase {}
152
+ class Server extends NetServer {
153
+ constructor(requestListener?: RequestListener);
154
+ constructor(options: ServerOptions, requestListener?: RequestListener);
217
155
  }
218
156
 
219
157
  // https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js
@@ -260,7 +198,7 @@ declare module 'http' {
260
198
  // https://github.com/nodejs/node/blob/master/test/parallel/test-http-write-callbacks.js#L53
261
199
  // no args in writeContinue callback
262
200
  writeContinue(callback?: () => void): void;
263
- writeHead(statusCode: number, statusMessage?: string, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this;
201
+ writeHead(statusCode: number, reasonPhrase?: string, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this;
264
202
  writeHead(statusCode: number, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this;
265
203
  writeProcessing(): void;
266
204
  }
@@ -499,3 +437,7 @@ declare module 'http' {
499
437
  */
500
438
  function urlToHttpOptions(url: URL): ClientRequestArgs;
501
439
  }
440
+
441
+ declare module 'node:http' {
442
+ export * from 'http';
443
+ }
@@ -666,7 +666,6 @@ declare module 'http2' {
666
666
  readonly connection: net.Socket | tls.TLSSocket;
667
667
  readonly finished: boolean;
668
668
  readonly headersSent: boolean;
669
- readonly req: Http2ServerRequest;
670
669
  readonly socket: net.Socket | tls.TLSSocket;
671
670
  readonly stream: ServerHttp2Stream;
672
671
  sendDate: boolean;
@@ -975,3 +974,7 @@ declare module 'http2' {
975
974
  listener?: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void
976
975
  ): ClientHttp2Session;
977
976
  }
977
+
978
+ declare module 'node:http2' {
979
+ export * from 'http2';
980
+ }
node/https.d.ts ADDED
@@ -0,0 +1,40 @@
1
+ declare module 'https' {
2
+ import * as tls from 'tls';
3
+ import * as http from 'http';
4
+ import { URL } from 'url';
5
+
6
+ type ServerOptions = tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions;
7
+
8
+ type RequestOptions = http.RequestOptions & tls.SecureContextOptions & {
9
+ rejectUnauthorized?: boolean; // Defaults to true
10
+ servername?: string; // SNI TLS Extension
11
+ };
12
+
13
+ interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions {
14
+ rejectUnauthorized?: boolean;
15
+ maxCachedSessions?: number;
16
+ }
17
+
18
+ class Agent extends http.Agent {
19
+ constructor(options?: AgentOptions);
20
+ options: AgentOptions;
21
+ }
22
+
23
+ interface Server extends http.HttpBase {}
24
+ class Server extends tls.Server {
25
+ constructor(requestListener?: http.RequestListener);
26
+ constructor(options: ServerOptions, requestListener?: http.RequestListener);
27
+ }
28
+
29
+ function createServer(requestListener?: http.RequestListener): Server;
30
+ function createServer(options: ServerOptions, requestListener?: http.RequestListener): Server;
31
+ function request(options: RequestOptions | string | URL, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
32
+ function request(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
33
+ function get(options: RequestOptions | string | URL, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
34
+ function get(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
35
+ let globalAgent: Agent;
36
+ }
37
+
38
+ declare module 'node:https' {
39
+ export * from 'https';
40
+ }
@@ -1,4 +1,4 @@
1
- // Type definitions for non-npm package Node.js 15.14
1
+ // Type definitions for non-npm package Node.js 16.0
2
2
  // Project: http://nodejs.org/
3
3
  // Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
4
4
  // DefinitelyTyped <https://github.com/DefinitelyTyped>