@types/node 20.16.1 → 20.16.3

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 v20.16/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/v20.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Mon, 19 Aug 2024 02:45:10 GMT
11
+ * Last updated: Sun, 01 Sep 2024 12:10:27 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
node v20.16/buffer.d.ts CHANGED
@@ -1,3 +1,8 @@
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
+ type _File = typeof globalThis extends { onmessage: any; File: any } ? {} : import("buffer").File;
5
+
1
6
  /**
2
7
  * `Buffer` objects are used to represent a fixed-length sequence of bytes. Many
3
8
  * Node.js APIs support `Buffer`s.
@@ -233,10 +238,7 @@ declare module "buffer" {
233
238
  }
234
239
  export import atob = globalThis.atob;
235
240
  export import btoa = globalThis.btoa;
236
- import { Blob as NodeBlob } from "buffer";
237
- // This conditional type will be the existing global Blob in a browser, or
238
- // the copy below in a Node environment.
239
- type __Blob = typeof globalThis extends { onmessage: any; Blob: any } ? {} : NodeBlob;
241
+
240
242
  global {
241
243
  namespace NodeJS {
242
244
  export { BufferEncoding };
@@ -2276,17 +2278,22 @@ declare module "buffer" {
2276
2278
  * @param data An ASCII (Latin1) string.
2277
2279
  */
2278
2280
  function btoa(data: string): string;
2279
- interface Blob extends __Blob {}
2281
+ interface Blob extends _Blob {}
2280
2282
  /**
2281
2283
  * `Blob` class is a global reference for `require('node:buffer').Blob`
2282
2284
  * https://nodejs.org/api/buffer.html#class-blob
2283
2285
  * @since v18.0.0
2284
2286
  */
2285
- var Blob: typeof globalThis extends {
2286
- onmessage: any;
2287
- Blob: infer T;
2288
- } ? T
2289
- : typeof NodeBlob;
2287
+ var Blob: typeof globalThis extends { onmessage: any; Blob: infer T } ? T
2288
+ : typeof import("buffer").Blob;
2289
+ interface File extends _File {}
2290
+ /**
2291
+ * `File` class is a global reference for `require('node:buffer').File`
2292
+ * https://nodejs.org/api/buffer.html#class-file
2293
+ * @since v20.0.0
2294
+ */
2295
+ var File: typeof globalThis extends { onmessage: any; File: infer T } ? T
2296
+ : typeof import("buffer").File;
2290
2297
  }
2291
2298
  }
2292
2299
  declare module "node:buffer" {
@@ -7,13 +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
- type _File = typeof globalThis extends { onmessage: any } ? {} : import("node:buffer").File;
15
15
  // #endregion Fetch and friends
16
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
+
17
87
  declare global {
18
88
  // Declare "static" methods in Error
19
89
  interface ErrorConstructor {
@@ -157,6 +227,24 @@ declare global {
157
227
  transfer?: { transfer: ReadonlyArray<import("worker_threads").TransferListItem> },
158
228
  ): T;
159
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
+
160
248
  /*----------------------------------------------*
161
249
  * *
162
250
  * GLOBAL INTERFACES *
@@ -403,10 +491,13 @@ declare global {
403
491
  } ? T
404
492
  : typeof import("undici-types").Headers;
405
493
 
406
- interface File extends _File {}
407
- var File: typeof globalThis extends {
494
+ interface MessageEvent extends _MessageEvent {}
495
+ /**
496
+ * @since v15.0.0
497
+ */
498
+ var MessageEvent: typeof globalThis extends {
408
499
  onmessage: any;
409
- File: infer T;
500
+ MessageEvent: infer T;
410
501
  } ? T
411
- : typeof import("node:buffer").File;
502
+ : typeof import("undici-types").MessageEvent;
412
503
  }