@types/node 18.19.47 → 18.19.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
node v18.19/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v18.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Wed, 28 Aug 2024 00:27:14 GMT
11
+ * Last updated: Wed, 04 Sep 2024 00:28:08 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
node v18.19/buffer.d.ts CHANGED
@@ -1,3 +1,7 @@
1
+ // If lib.dom.d.ts or lib.webworker.d.ts is loaded, then use the global types.
2
+ // Otherwise, use the types from node.
3
+ type _Blob = typeof globalThis extends { onmessage: any; Blob: any } ? {} : import("buffer").Blob;
4
+
1
5
  /**
2
6
  * `Buffer` objects are used to represent a fixed-length sequence of bytes. Many
3
7
  * Node.js APIs support `Buffer`s.
@@ -212,10 +216,7 @@ declare module "buffer" {
212
216
  }
213
217
  export import atob = globalThis.atob;
214
218
  export import btoa = globalThis.btoa;
215
- import { Blob as NodeBlob } from "buffer";
216
- // This conditional type will be the existing global Blob in a browser, or
217
- // the copy below in a Node environment.
218
- type __Blob = typeof globalThis extends { onmessage: any; Blob: any } ? {} : NodeBlob;
219
+
219
220
  global {
220
221
  namespace NodeJS {
221
222
  export { BufferEncoding };
@@ -2254,17 +2255,14 @@ declare module "buffer" {
2254
2255
  * @param data An ASCII (Latin1) string.
2255
2256
  */
2256
2257
  function btoa(data: string): string;
2257
- interface Blob extends __Blob {}
2258
+ interface Blob extends _Blob {}
2258
2259
  /**
2259
2260
  * `Blob` class is a global reference for `require('node:buffer').Blob`
2260
2261
  * https://nodejs.org/api/buffer.html#class-blob
2261
2262
  * @since v18.0.0
2262
2263
  */
2263
- var Blob: typeof globalThis extends {
2264
- onmessage: any;
2265
- Blob: infer T;
2266
- } ? T
2267
- : typeof NodeBlob;
2264
+ var Blob: typeof globalThis extends { onmessage: any; Blob: infer T } ? T
2265
+ : typeof import("buffer").Blob;
2268
2266
  }
2269
2267
  }
2270
2268
  declare module "node:buffer" {
@@ -7,12 +7,83 @@ type _Request = typeof globalThis extends { onmessage: any } ? {} : import("undi
7
7
  type _Response = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Response;
8
8
  type _FormData = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").FormData;
9
9
  type _Headers = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Headers;
10
+ type _MessageEvent = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").MessageEvent;
10
11
  type _RequestInit = typeof globalThis extends { onmessage: any } ? {}
11
12
  : import("undici-types").RequestInit;
12
13
  type _ResponseInit = typeof globalThis extends { onmessage: any } ? {}
13
14
  : import("undici-types").ResponseInit;
14
15
  // #endregion Fetch and friends
15
16
 
17
+ // #region DOMException
18
+ type _DOMException = typeof globalThis extends { onmessage: any } ? {} : NodeDOMException;
19
+ interface NodeDOMException extends Error {
20
+ /**
21
+ * @deprecated
22
+ *
23
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)
24
+ */
25
+ readonly code: number;
26
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message) */
27
+ readonly message: string;
28
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name) */
29
+ readonly name: string;
30
+ readonly INDEX_SIZE_ERR: 1;
31
+ readonly DOMSTRING_SIZE_ERR: 2;
32
+ readonly HIERARCHY_REQUEST_ERR: 3;
33
+ readonly WRONG_DOCUMENT_ERR: 4;
34
+ readonly INVALID_CHARACTER_ERR: 5;
35
+ readonly NO_DATA_ALLOWED_ERR: 6;
36
+ readonly NO_MODIFICATION_ALLOWED_ERR: 7;
37
+ readonly NOT_FOUND_ERR: 8;
38
+ readonly NOT_SUPPORTED_ERR: 9;
39
+ readonly INUSE_ATTRIBUTE_ERR: 10;
40
+ readonly INVALID_STATE_ERR: 11;
41
+ readonly SYNTAX_ERR: 12;
42
+ readonly INVALID_MODIFICATION_ERR: 13;
43
+ readonly NAMESPACE_ERR: 14;
44
+ readonly INVALID_ACCESS_ERR: 15;
45
+ readonly VALIDATION_ERR: 16;
46
+ readonly TYPE_MISMATCH_ERR: 17;
47
+ readonly SECURITY_ERR: 18;
48
+ readonly NETWORK_ERR: 19;
49
+ readonly ABORT_ERR: 20;
50
+ readonly URL_MISMATCH_ERR: 21;
51
+ readonly QUOTA_EXCEEDED_ERR: 22;
52
+ readonly TIMEOUT_ERR: 23;
53
+ readonly INVALID_NODE_TYPE_ERR: 24;
54
+ readonly DATA_CLONE_ERR: 25;
55
+ }
56
+ interface NodeDOMExceptionConstructor {
57
+ prototype: DOMException;
58
+ new(message?: string, nameOrOptions?: string | { name?: string; cause?: unknown }): DOMException;
59
+ readonly INDEX_SIZE_ERR: 1;
60
+ readonly DOMSTRING_SIZE_ERR: 2;
61
+ readonly HIERARCHY_REQUEST_ERR: 3;
62
+ readonly WRONG_DOCUMENT_ERR: 4;
63
+ readonly INVALID_CHARACTER_ERR: 5;
64
+ readonly NO_DATA_ALLOWED_ERR: 6;
65
+ readonly NO_MODIFICATION_ALLOWED_ERR: 7;
66
+ readonly NOT_FOUND_ERR: 8;
67
+ readonly NOT_SUPPORTED_ERR: 9;
68
+ readonly INUSE_ATTRIBUTE_ERR: 10;
69
+ readonly INVALID_STATE_ERR: 11;
70
+ readonly SYNTAX_ERR: 12;
71
+ readonly INVALID_MODIFICATION_ERR: 13;
72
+ readonly NAMESPACE_ERR: 14;
73
+ readonly INVALID_ACCESS_ERR: 15;
74
+ readonly VALIDATION_ERR: 16;
75
+ readonly TYPE_MISMATCH_ERR: 17;
76
+ readonly SECURITY_ERR: 18;
77
+ readonly NETWORK_ERR: 19;
78
+ readonly ABORT_ERR: 20;
79
+ readonly URL_MISMATCH_ERR: 21;
80
+ readonly QUOTA_EXCEEDED_ERR: 22;
81
+ readonly TIMEOUT_ERR: 23;
82
+ readonly INVALID_NODE_TYPE_ERR: 24;
83
+ readonly DATA_CLONE_ERR: 25;
84
+ }
85
+ // #endregion DOMException
86
+
16
87
  declare global {
17
88
  // Declare "static" methods in Error
18
89
  interface ErrorConstructor {
@@ -156,6 +227,24 @@ declare global {
156
227
  transfer?: { transfer: ReadonlyArray<import("worker_threads").TransferListItem> },
157
228
  ): T;
158
229
 
230
+ // #region DOMException
231
+ /**
232
+ * @since v17.0.0
233
+ * An abnormal event (called an exception) which occurs as a result of calling a method or accessing a property of a web API.
234
+ *
235
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)
236
+ */
237
+ interface DOMException extends _DOMException {}
238
+
239
+ /**
240
+ * @since v17.0.0
241
+ *
242
+ * The WHATWG `DOMException` class. See [DOMException](https://developer.mozilla.org/docs/Web/API/DOMException) for more details.
243
+ */
244
+ var DOMException: typeof globalThis extends { onmessage: any; DOMException: infer T } ? T
245
+ : NodeDOMExceptionConstructor;
246
+ // #endregion DOMException
247
+
159
248
  /*----------------------------------------------*
160
249
  * *
161
250
  * GLOBAL INTERFACES *
@@ -375,4 +464,14 @@ declare global {
375
464
  Headers: infer T;
376
465
  } ? T
377
466
  : typeof import("undici-types").Headers;
467
+
468
+ interface MessageEvent extends _MessageEvent {}
469
+ /**
470
+ * @since v15.0.0
471
+ */
472
+ var MessageEvent: typeof globalThis extends {
473
+ onmessage: any;
474
+ MessageEvent: infer T;
475
+ } ? T
476
+ : typeof import("undici-types").MessageEvent;
378
477
  }
node v18.19/http.d.ts CHANGED
@@ -231,7 +231,7 @@ declare module "http" {
231
231
  }
232
232
  interface ServerOptions<
233
233
  Request extends typeof IncomingMessage = typeof IncomingMessage,
234
- Response extends typeof ServerResponse = typeof ServerResponse,
234
+ Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse<InstanceType<Request>>,
235
235
  > {
236
236
  /**
237
237
  * Specifies the `IncomingMessage` class to be used. Useful for extending the original `IncomingMessage`.
@@ -316,14 +316,14 @@ declare module "http" {
316
316
  }
317
317
  type RequestListener<
318
318
  Request extends typeof IncomingMessage = typeof IncomingMessage,
319
- Response extends typeof ServerResponse = typeof ServerResponse,
319
+ Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse<InstanceType<Request>>,
320
320
  > = (req: InstanceType<Request>, res: InstanceType<Response> & { req: InstanceType<Request> }) => void;
321
321
  /**
322
322
  * @since v0.1.17
323
323
  */
324
324
  class Server<
325
325
  Request extends typeof IncomingMessage = typeof IncomingMessage,
326
- Response extends typeof ServerResponse = typeof ServerResponse,
326
+ Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse<InstanceType<Request>>,
327
327
  > extends NetServer {
328
328
  constructor(requestListener?: RequestListener<Request, Response>);
329
329
  constructor(options: ServerOptions<Request, Response>, requestListener?: RequestListener<Request, Response>);
@@ -1499,11 +1499,11 @@ declare module "http" {
1499
1499
  */
1500
1500
  function createServer<
1501
1501
  Request extends typeof IncomingMessage = typeof IncomingMessage,
1502
- Response extends typeof ServerResponse = typeof ServerResponse,
1502
+ Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse<InstanceType<Request>>,
1503
1503
  >(requestListener?: RequestListener<Request, Response>): Server<Request, Response>;
1504
1504
  function createServer<
1505
1505
  Request extends typeof IncomingMessage = typeof IncomingMessage,
1506
- Response extends typeof ServerResponse = typeof ServerResponse,
1506
+ Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse<InstanceType<Request>>,
1507
1507
  >(
1508
1508
  options: ServerOptions<Request, Response>,
1509
1509
  requestListener?: RequestListener<Request, Response>,