@types/node 22.17.2 → 22.18.1

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 (73) hide show
  1. {node v22.17 → node v22.18}/README.md +1 -1
  2. {node v22.17 → node v22.18}/buffer.d.ts +1 -1
  3. {node v22.17 → node v22.18}/child_process.d.ts +1 -1
  4. {node v22.17 → node v22.18}/fs/promises.d.ts +19 -26
  5. {node v22.17 → node v22.18}/fs.d.ts +17 -34
  6. node v22.18/globals.d.ts +170 -0
  7. {node v22.17 → node v22.18}/http.d.ts +1 -1
  8. {node v22.17 → node v22.18}/index.d.ts +6 -1
  9. {node v22.17 → node v22.18}/inspector.d.ts +68 -12
  10. {node v22.17 → node v22.18}/module.d.ts +24 -0
  11. {node v22.17 → node v22.18}/package.json +2 -2
  12. {node v22.17 → node v22.18}/process.d.ts +3 -2
  13. {node v22.17 → node v22.18}/sqlite.d.ts +35 -0
  14. {node v22.17 → node v22.18}/ts5.6/index.d.ts +6 -1
  15. {node v22.17 → node v22.18}/url.d.ts +11 -0
  16. node v22.18/web-globals/abortcontroller.d.ts +34 -0
  17. node v22.18/web-globals/domexception.d.ts +68 -0
  18. node v22.17/dom-events.d.ts → node v22.18/web-globals/events.d.ts +47 -52
  19. node v22.18/web-globals/fetch.d.ts +46 -0
  20. node v22.18/web-globals/navigator.d.ts +22 -0
  21. node v22.18/web-globals/storage.d.ts +24 -0
  22. {node v22.17 → node v22.18}/worker_threads.d.ts +12 -0
  23. node v22.17/globals.d.ts +0 -364
  24. {node v22.17 → node v22.18}/LICENSE +0 -0
  25. {node v22.17 → node v22.18}/assert/strict.d.ts +0 -0
  26. {node v22.17 → node v22.18}/assert.d.ts +0 -0
  27. {node v22.17 → node v22.18}/async_hooks.d.ts +0 -0
  28. {node v22.17 → node v22.18}/buffer.buffer.d.ts +0 -0
  29. {node v22.17 → node v22.18}/cluster.d.ts +0 -0
  30. {node v22.17 → node v22.18}/compatibility/disposable.d.ts +0 -0
  31. {node v22.17 → node v22.18}/compatibility/index.d.ts +0 -0
  32. {node v22.17 → node v22.18}/compatibility/indexable.d.ts +0 -0
  33. {node v22.17 → node v22.18}/compatibility/iterators.d.ts +0 -0
  34. {node v22.17 → node v22.18}/console.d.ts +0 -0
  35. {node v22.17 → node v22.18}/constants.d.ts +0 -0
  36. {node v22.17 → node v22.18}/crypto.d.ts +0 -0
  37. {node v22.17 → node v22.18}/dgram.d.ts +0 -0
  38. {node v22.17 → node v22.18}/diagnostics_channel.d.ts +0 -0
  39. {node v22.17 → node v22.18}/dns/promises.d.ts +0 -0
  40. {node v22.17 → node v22.18}/dns.d.ts +0 -0
  41. {node v22.17 → node v22.18}/domain.d.ts +0 -0
  42. {node v22.17 → node v22.18}/events.d.ts +0 -0
  43. {node v22.17 → node v22.18}/globals.typedarray.d.ts +0 -0
  44. {node v22.17 → node v22.18}/http2.d.ts +0 -0
  45. {node v22.17 → node v22.18}/https.d.ts +0 -0
  46. {node v22.17 → node v22.18}/net.d.ts +0 -0
  47. {node v22.17 → node v22.18}/os.d.ts +0 -0
  48. {node v22.17 → node v22.18}/path.d.ts +0 -0
  49. {node v22.17 → node v22.18}/perf_hooks.d.ts +0 -0
  50. {node v22.17 → node v22.18}/punycode.d.ts +0 -0
  51. {node v22.17 → node v22.18}/querystring.d.ts +0 -0
  52. {node v22.17 → node v22.18}/readline/promises.d.ts +0 -0
  53. {node v22.17 → node v22.18}/readline.d.ts +0 -0
  54. {node v22.17 → node v22.18}/repl.d.ts +0 -0
  55. {node v22.17 → node v22.18}/sea.d.ts +0 -0
  56. {node v22.17 → node v22.18}/stream/consumers.d.ts +0 -0
  57. {node v22.17 → node v22.18}/stream/promises.d.ts +0 -0
  58. {node v22.17 → node v22.18}/stream/web.d.ts +0 -0
  59. {node v22.17 → node v22.18}/stream.d.ts +0 -0
  60. {node v22.17 → node v22.18}/string_decoder.d.ts +0 -0
  61. {node v22.17 → node v22.18}/test.d.ts +0 -0
  62. {node v22.17 → node v22.18}/timers/promises.d.ts +0 -0
  63. {node v22.17 → node v22.18}/timers.d.ts +0 -0
  64. {node v22.17 → node v22.18}/tls.d.ts +0 -0
  65. {node v22.17 → node v22.18}/trace_events.d.ts +0 -0
  66. {node v22.17 → node v22.18}/ts5.6/buffer.buffer.d.ts +0 -0
  67. {node v22.17 → node v22.18}/ts5.6/globals.typedarray.d.ts +0 -0
  68. {node v22.17 → node v22.18}/tty.d.ts +0 -0
  69. {node v22.17 → node v22.18}/util.d.ts +0 -0
  70. {node v22.17 → node v22.18}/v8.d.ts +0 -0
  71. {node v22.17 → node v22.18}/vm.d.ts +0 -0
  72. {node v22.17 → node v22.18}/wasi.d.ts +0 -0
  73. {node v22.17 → node v22.18}/zlib.d.ts +0 -0
@@ -36,6 +36,12 @@
36
36
 
37
37
  // Definitions for Node.js modules that are not specific to any version of TypeScript:
38
38
  /// <reference path="../globals.d.ts" />
39
+ /// <reference path="../web-globals/abortcontroller.d.ts" />
40
+ /// <reference path="../web-globals/domexception.d.ts" />
41
+ /// <reference path="../web-globals/events.d.ts" />
42
+ /// <reference path="../web-globals/fetch.d.ts" />
43
+ /// <reference path="../web-globals/navigator.d.ts" />
44
+ /// <reference path="../web-globals/storage.d.ts" />
39
45
  /// <reference path="../assert.d.ts" />
40
46
  /// <reference path="../assert/strict.d.ts" />
41
47
  /// <reference path="../async_hooks.d.ts" />
@@ -51,7 +57,6 @@
51
57
  /// <reference path="../dns/promises.d.ts" />
52
58
  /// <reference path="../dns/promises.d.ts" />
53
59
  /// <reference path="../domain.d.ts" />
54
- /// <reference path="../dom-events.d.ts" />
55
60
  /// <reference path="../events.d.ts" />
56
61
  /// <reference path="../fs.d.ts" />
57
62
  /// <reference path="../fs/promises.d.ts" />
@@ -315,6 +315,17 @@ declare module "url" {
315
315
  * @return The fully-resolved platform-specific Node.js file path.
316
316
  */
317
317
  function fileURLToPath(url: string | URL, options?: FileUrlToPathOptions): string;
318
+ /**
319
+ * Like `url.fileURLToPath(...)` except that instead of returning a string
320
+ * representation of the path, a `Buffer` is returned. This conversion is
321
+ * helpful when the input URL contains percent-encoded segments that are
322
+ * not valid UTF-8 / Unicode sequences.
323
+ * @since v22.18.0
324
+ * @param url The file URL string or URL object to convert to a path.
325
+ * @returns The fully-resolved platform-specific Node.js file path
326
+ * as a `Buffer`.
327
+ */
328
+ function fileURLToPathBuffer(url: string | URL, options?: FileUrlToPathOptions): Buffer;
318
329
  /**
319
330
  * This function ensures that `path` is resolved absolutely, and that the URL
320
331
  * control characters are correctly encoded when converting into a File URL.
@@ -0,0 +1,34 @@
1
+ export {};
2
+
3
+ type _AbortController = typeof globalThis extends { onmessage: any } ? {} : AbortController;
4
+ interface AbortController {
5
+ readonly signal: AbortSignal;
6
+ abort(reason?: any): void;
7
+ }
8
+
9
+ type _AbortSignal = typeof globalThis extends { onmessage: any } ? {} : AbortSignal;
10
+ interface AbortSignal extends EventTarget {
11
+ readonly aborted: boolean;
12
+ onabort: ((this: AbortSignal, ev: Event) => any) | null;
13
+ readonly reason: any;
14
+ throwIfAborted(): void;
15
+ }
16
+
17
+ declare global {
18
+ interface AbortController extends _AbortController {}
19
+ var AbortController: typeof globalThis extends { onmessage: any; AbortController: infer T } ? T
20
+ : {
21
+ prototype: AbortController;
22
+ new(): AbortController;
23
+ };
24
+
25
+ interface AbortSignal extends _AbortSignal {}
26
+ var AbortSignal: typeof globalThis extends { onmessage: any; AbortSignal: infer T } ? T
27
+ : {
28
+ prototype: AbortSignal;
29
+ new(): AbortSignal;
30
+ abort(reason?: any): AbortSignal;
31
+ any(signals: AbortSignal[]): AbortSignal;
32
+ timeout(milliseconds: number): AbortSignal;
33
+ };
34
+ }
@@ -0,0 +1,68 @@
1
+ export {};
2
+
3
+ type _DOMException = typeof globalThis extends { onmessage: any } ? {} : DOMException;
4
+ interface DOMException extends Error {
5
+ readonly code: number;
6
+ readonly message: string;
7
+ readonly name: string;
8
+ readonly INDEX_SIZE_ERR: 1;
9
+ readonly DOMSTRING_SIZE_ERR: 2;
10
+ readonly HIERARCHY_REQUEST_ERR: 3;
11
+ readonly WRONG_DOCUMENT_ERR: 4;
12
+ readonly INVALID_CHARACTER_ERR: 5;
13
+ readonly NO_DATA_ALLOWED_ERR: 6;
14
+ readonly NO_MODIFICATION_ALLOWED_ERR: 7;
15
+ readonly NOT_FOUND_ERR: 8;
16
+ readonly NOT_SUPPORTED_ERR: 9;
17
+ readonly INUSE_ATTRIBUTE_ERR: 10;
18
+ readonly INVALID_STATE_ERR: 11;
19
+ readonly SYNTAX_ERR: 12;
20
+ readonly INVALID_MODIFICATION_ERR: 13;
21
+ readonly NAMESPACE_ERR: 14;
22
+ readonly INVALID_ACCESS_ERR: 15;
23
+ readonly VALIDATION_ERR: 16;
24
+ readonly TYPE_MISMATCH_ERR: 17;
25
+ readonly SECURITY_ERR: 18;
26
+ readonly NETWORK_ERR: 19;
27
+ readonly ABORT_ERR: 20;
28
+ readonly URL_MISMATCH_ERR: 21;
29
+ readonly QUOTA_EXCEEDED_ERR: 22;
30
+ readonly TIMEOUT_ERR: 23;
31
+ readonly INVALID_NODE_TYPE_ERR: 24;
32
+ readonly DATA_CLONE_ERR: 25;
33
+ }
34
+
35
+ declare global {
36
+ interface DOMException extends _DOMException {}
37
+ var DOMException: typeof globalThis extends { onmessage: any; DOMException: infer T } ? T
38
+ : {
39
+ prototype: DOMException;
40
+ new(message?: string, name?: string): DOMException;
41
+ new(message?: string, options?: { name?: string; cause?: unknown }): DOMException;
42
+ readonly INDEX_SIZE_ERR: 1;
43
+ readonly DOMSTRING_SIZE_ERR: 2;
44
+ readonly HIERARCHY_REQUEST_ERR: 3;
45
+ readonly WRONG_DOCUMENT_ERR: 4;
46
+ readonly INVALID_CHARACTER_ERR: 5;
47
+ readonly NO_DATA_ALLOWED_ERR: 6;
48
+ readonly NO_MODIFICATION_ALLOWED_ERR: 7;
49
+ readonly NOT_FOUND_ERR: 8;
50
+ readonly NOT_SUPPORTED_ERR: 9;
51
+ readonly INUSE_ATTRIBUTE_ERR: 10;
52
+ readonly INVALID_STATE_ERR: 11;
53
+ readonly SYNTAX_ERR: 12;
54
+ readonly INVALID_MODIFICATION_ERR: 13;
55
+ readonly NAMESPACE_ERR: 14;
56
+ readonly INVALID_ACCESS_ERR: 15;
57
+ readonly VALIDATION_ERR: 16;
58
+ readonly TYPE_MISMATCH_ERR: 17;
59
+ readonly SECURITY_ERR: 18;
60
+ readonly NETWORK_ERR: 19;
61
+ readonly ABORT_ERR: 20;
62
+ readonly URL_MISMATCH_ERR: 21;
63
+ readonly QUOTA_EXCEEDED_ERR: 22;
64
+ readonly TIMEOUT_ERR: 23;
65
+ readonly INVALID_NODE_TYPE_ERR: 24;
66
+ readonly DATA_CLONE_ERR: 25;
67
+ };
68
+ }
@@ -1,37 +1,61 @@
1
- // Make this a module
2
1
  export {};
3
2
 
4
- // Conditional type aliases, which are later merged into the global scope.
5
- // Will either be empty if the relevant web library is already present, or the @types/node definition otherwise.
3
+ interface AddEventListenerOptions extends EventListenerOptions {
4
+ once?: boolean;
5
+ passive?: boolean;
6
+ signal?: AbortSignal;
7
+ }
6
8
 
7
- type __Event = typeof globalThis extends { onmessage: any } ? {} : Event;
9
+ type _CustomEvent<T = any> = typeof globalThis extends { onmessage: any } ? {} : CustomEvent<T>;
10
+ interface CustomEvent<T = any> extends Event {
11
+ readonly detail: T;
12
+ }
13
+
14
+ interface CustomEventInit<T = any> extends EventInit {
15
+ detail?: T;
16
+ }
17
+
18
+ type _Event = typeof globalThis extends { onmessage: any } ? {} : Event;
8
19
  interface Event {
9
20
  readonly bubbles: boolean;
10
21
  cancelBubble: boolean;
11
22
  readonly cancelable: boolean;
12
23
  readonly composed: boolean;
13
- composedPath(): [EventTarget?];
14
24
  readonly currentTarget: EventTarget | null;
15
25
  readonly defaultPrevented: boolean;
16
26
  readonly eventPhase: 0 | 2;
17
- initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void;
18
27
  readonly isTrusted: boolean;
19
- preventDefault(): void;
20
- readonly returnValue: boolean;
28
+ returnValue: boolean;
21
29
  readonly srcElement: EventTarget | null;
22
- stopImmediatePropagation(): void;
23
- stopPropagation(): void;
24
30
  readonly target: EventTarget | null;
25
31
  readonly timeStamp: number;
26
32
  readonly type: string;
33
+ composedPath(): [EventTarget?];
34
+ initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void;
35
+ preventDefault(): void;
36
+ stopImmediatePropagation(): void;
37
+ stopPropagation(): void;
27
38
  }
28
39
 
29
- type __CustomEvent<T = any> = typeof globalThis extends { onmessage: any } ? {} : CustomEvent<T>;
30
- interface CustomEvent<T = any> extends Event {
31
- readonly detail: T;
40
+ interface EventInit {
41
+ bubbles?: boolean;
42
+ cancelable?: boolean;
43
+ composed?: boolean;
44
+ }
45
+
46
+ interface EventListener {
47
+ (evt: Event): void;
48
+ }
49
+
50
+ interface EventListenerObject {
51
+ handleEvent(object: Event): void;
52
+ }
53
+
54
+ interface EventListenerOptions {
55
+ capture?: boolean;
32
56
  }
33
57
 
34
- type __EventTarget = typeof globalThis extends { onmessage: any } ? {} : EventTarget;
58
+ type _EventTarget = typeof globalThis extends { onmessage: any } ? {} : EventTarget;
35
59
  interface EventTarget {
36
60
  addEventListener(
37
61
  type: string,
@@ -46,51 +70,22 @@ interface EventTarget {
46
70
  ): void;
47
71
  }
48
72
 
49
- interface EventInit {
50
- bubbles?: boolean;
51
- cancelable?: boolean;
52
- composed?: boolean;
53
- }
54
-
55
- interface CustomEventInit<T = any> extends EventInit {
56
- detail?: T;
57
- }
58
-
59
- interface EventListenerOptions {
60
- capture?: boolean;
61
- }
62
-
63
- interface AddEventListenerOptions extends EventListenerOptions {
64
- once?: boolean;
65
- passive?: boolean;
66
- signal?: AbortSignal;
67
- }
68
-
69
- interface EventListener {
70
- (evt: Event): void;
71
- }
72
-
73
- interface EventListenerObject {
74
- handleEvent(object: Event): void;
75
- }
76
-
77
- // Merge conditional interfaces into global scope, and conditionally declare global constructors.
78
73
  declare global {
79
- interface Event extends __Event {}
80
- var Event: typeof globalThis extends { onmessage: any; Event: infer T } ? T
81
- : {
82
- prototype: Event;
83
- new(type: string, eventInitDict?: EventInit): Event;
84
- };
85
-
86
- interface CustomEvent<T = any> extends __CustomEvent<T> {}
74
+ interface CustomEvent<T = any> extends _CustomEvent<T> {}
87
75
  var CustomEvent: typeof globalThis extends { onmessage: any; CustomEvent: infer T } ? T
88
76
  : {
89
77
  prototype: CustomEvent;
90
78
  new<T>(type: string, eventInitDict?: CustomEventInit<T>): CustomEvent<T>;
91
79
  };
92
80
 
93
- interface EventTarget extends __EventTarget {}
81
+ interface Event extends _Event {}
82
+ var Event: typeof globalThis extends { onmessage: any; Event: infer T } ? T
83
+ : {
84
+ prototype: Event;
85
+ new(type: string, eventInitDict?: EventInit): Event;
86
+ };
87
+
88
+ interface EventTarget extends _EventTarget {}
94
89
  var EventTarget: typeof globalThis extends { onmessage: any; EventTarget: infer T } ? T
95
90
  : {
96
91
  prototype: EventTarget;
@@ -0,0 +1,46 @@
1
+ export {};
2
+
3
+ import * as undici from "undici-types";
4
+
5
+ type _EventSource = typeof globalThis extends { onmessage: any } ? {} : undici.EventSource;
6
+ type _FormData = typeof globalThis extends { onmessage: any } ? {} : undici.FormData;
7
+ type _Headers = typeof globalThis extends { onmessage: any } ? {} : undici.Headers;
8
+ type _MessageEvent = typeof globalThis extends { onmessage: any } ? {} : undici.MessageEvent;
9
+ type _Request = typeof globalThis extends { onmessage: any } ? {} : undici.Request;
10
+ type _RequestInit = typeof globalThis extends { onmessage: any } ? {} : undici.RequestInit;
11
+ type _Response = typeof globalThis extends { onmessage: any } ? {} : undici.Response;
12
+ type _ResponseInit = typeof globalThis extends { onmessage: any } ? {} : undici.ResponseInit;
13
+ type _WebSocket = typeof globalThis extends { onmessage: any } ? {} : undici.WebSocket;
14
+
15
+ declare global {
16
+ function fetch(
17
+ input: string | URL | Request,
18
+ init?: RequestInit,
19
+ ): Promise<Response>;
20
+
21
+ interface EventSource extends _EventSource {}
22
+ var EventSource: typeof globalThis extends { onmessage: any; EventSource: infer T } ? T : typeof undici.EventSource;
23
+
24
+ interface FormData extends _FormData {}
25
+ var FormData: typeof globalThis extends { onmessage: any; FormData: infer T } ? T : typeof undici.FormData;
26
+
27
+ interface Headers extends _Headers {}
28
+ var Headers: typeof globalThis extends { onmessage: any; Headers: infer T } ? T : typeof undici.Headers;
29
+
30
+ interface MessageEvent extends _MessageEvent {}
31
+ var MessageEvent: typeof globalThis extends { onmessage: any; MessageEvent: infer T } ? T
32
+ : typeof undici.MessageEvent;
33
+
34
+ interface Request extends _Request {}
35
+ var Request: typeof globalThis extends { onmessage: any; Request: infer T } ? T : typeof undici.Request;
36
+
37
+ interface RequestInit extends _RequestInit {}
38
+
39
+ interface Response extends _Response {}
40
+ var Response: typeof globalThis extends { onmessage: any; Response: infer T } ? T : typeof undici.Response;
41
+
42
+ interface ResponseInit extends _ResponseInit {}
43
+
44
+ interface WebSocket extends _WebSocket {}
45
+ var WebSocket: typeof globalThis extends { onmessage: any; WebSocket: infer T } ? T : typeof undici.WebSocket;
46
+ }
@@ -0,0 +1,22 @@
1
+ export {};
2
+
3
+ // lib.webworker has `WorkerNavigator` rather than `Navigator`, so conditionals use `onabort` instead of `onmessage`
4
+ type _Navigator = typeof globalThis extends { onabort: any } ? {} : Navigator;
5
+ interface Navigator {
6
+ readonly hardwareConcurrency: number;
7
+ readonly language: string;
8
+ readonly languages: readonly string[];
9
+ readonly platform: string;
10
+ readonly userAgent: string;
11
+ }
12
+
13
+ declare global {
14
+ interface Navigator extends _Navigator {}
15
+ var Navigator: typeof globalThis extends { onabort: any; Navigator: infer T } ? T : {
16
+ prototype: Navigator;
17
+ new(): Navigator;
18
+ };
19
+
20
+ // Needs conditional inference for lib.dom and lib.webworker compatibility
21
+ var navigator: typeof globalThis extends { onmessage: any; navigator: infer T } ? T : Navigator;
22
+ }
@@ -0,0 +1,24 @@
1
+ export {};
2
+
3
+ // These interfaces are absent from lib.webworker, so the conditionals use `onabort` rather than `onmessage`
4
+ type _Storage = typeof globalThis extends { onabort: any } ? {} : Storage;
5
+ interface Storage {
6
+ readonly length: number;
7
+ clear(): void;
8
+ getItem(key: string): string | null;
9
+ key(index: number): string | null;
10
+ removeItem(key: string): void;
11
+ setItem(key: string, value: string): void;
12
+ [key: string]: any;
13
+ }
14
+
15
+ declare global {
16
+ interface Storage extends _Storage {}
17
+ var Storage: typeof globalThis extends { onabort: any; Storage: infer T } ? T : {
18
+ prototype: Storage;
19
+ new(): Storage;
20
+ };
21
+
22
+ var localStorage: Storage;
23
+ var sessionStorage: Storage;
24
+ }
@@ -481,6 +481,18 @@ declare module "worker_threads" {
481
481
  * @since v22.16.0
482
482
  */
483
483
  getHeapStatistics(): Promise<HeapInfo>;
484
+ /**
485
+ * Calls `worker.terminate()` when the dispose scope is exited.
486
+ *
487
+ * ```js
488
+ * async function example() {
489
+ * await using worker = new Worker('for (;;) {}', { eval: true });
490
+ * // Worker is automatically terminate when the scope is exited.
491
+ * }
492
+ * ```
493
+ * @since v22.18.0
494
+ */
495
+ [Symbol.asyncDispose](): Promise<void>;
484
496
  addListener(event: "error", listener: (err: Error) => void): this;
485
497
  addListener(event: "exit", listener: (exitCode: number) => void): this;
486
498
  addListener(event: "message", listener: (value: any) => void): this;