@types/node 22.15.21 → 22.19.7

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 (80) hide show
  1. node v22.19/README.md +15 -0
  2. node v22.19/assert/strict.d.ts +111 -0
  3. node/assert.d.ts → node v22.19/assert.d.ts +119 -95
  4. node/buffer.buffer.d.ts → node v22.19/buffer.buffer.d.ts +9 -0
  5. node/buffer.d.ts → node v22.19/buffer.d.ts +14 -6
  6. node/child_process.d.ts → node v22.19/child_process.d.ts +89 -162
  7. node/cluster.d.ts → node v22.19/cluster.d.ts +4 -5
  8. node/compatibility/disposable.d.ts → node v22.19/compatibility/disposable.d.ts +0 -2
  9. node/compatibility/indexable.d.ts → node v22.19/compatibility/indexable.d.ts +0 -3
  10. node/compatibility/iterators.d.ts → node v22.19/compatibility/iterators.d.ts +0 -1
  11. node/crypto.d.ts → node v22.19/crypto.d.ts +203 -167
  12. node/dgram.d.ts → node v22.19/dgram.d.ts +9 -8
  13. node/diagnostics_channel.d.ts → node v22.19/diagnostics_channel.d.ts +17 -12
  14. node/dns/promises.d.ts → node v22.19/dns/promises.d.ts +36 -9
  15. node/dns.d.ts → node v22.19/dns.d.ts +79 -21
  16. node/events.d.ts → node v22.19/events.d.ts +80 -35
  17. node/fs/promises.d.ts → node v22.19/fs/promises.d.ts +81 -58
  18. node/fs.d.ts → node v22.19/fs.d.ts +154 -130
  19. node v22.19/globals.d.ts +172 -0
  20. node v22.19/globals.typedarray.d.ts +38 -0
  21. node/http.d.ts → node v22.19/http.d.ts +140 -35
  22. node/http2.d.ts → node v22.19/http2.d.ts +114 -27
  23. node/https.d.ts → node v22.19/https.d.ts +96 -62
  24. node/index.d.ts → node v22.19/index.d.ts +7 -2
  25. node v22.19/inspector.d.ts +253 -0
  26. node/inspector.d.ts → node v22.19/inspector.generated.d.ts +880 -830
  27. node/module.d.ts → node v22.19/module.d.ts +136 -17
  28. node/net.d.ts → node v22.19/net.d.ts +33 -11
  29. node/os.d.ts → node v22.19/os.d.ts +14 -3
  30. node/package.json → node v22.19/package.json +3 -83
  31. node/path.d.ts → node v22.19/path.d.ts +1 -1
  32. node/perf_hooks.d.ts → node v22.19/perf_hooks.d.ts +8 -10
  33. node/process.d.ts → node v22.19/process.d.ts +53 -27
  34. node/readline/promises.d.ts → node v22.19/readline/promises.d.ts +1 -2
  35. node/repl.d.ts → node v22.19/repl.d.ts +3 -5
  36. node/sqlite.d.ts → node v22.19/sqlite.d.ts +219 -6
  37. node/stream/consumers.d.ts → node v22.19/stream/consumers.d.ts +2 -2
  38. node/stream/web.d.ts → node v22.19/stream/web.d.ts +8 -0
  39. node/stream.d.ts → node v22.19/stream.d.ts +34 -32
  40. node/string_decoder.d.ts → node v22.19/string_decoder.d.ts +2 -2
  41. node v22.19/test.d.ts +2162 -0
  42. node/tls.d.ts → node v22.19/tls.d.ts +126 -66
  43. node/ts5.6/buffer.buffer.d.ts → node v22.19/ts5.6/buffer.buffer.d.ts +10 -2
  44. node v22.19/ts5.6/globals.typedarray.d.ts +34 -0
  45. node/ts5.6/index.d.ts → node v22.19/ts5.6/index.d.ts +7 -2
  46. node/url.d.ts → node v22.19/url.d.ts +21 -9
  47. node/util.d.ts → node v22.19/util.d.ts +33 -11
  48. node/v8.d.ts → node v22.19/v8.d.ts +66 -35
  49. node/vm.d.ts → node v22.19/vm.d.ts +65 -56
  50. node/wasi.d.ts → node v22.19/wasi.d.ts +1 -1
  51. node v22.19/web-globals/abortcontroller.d.ts +34 -0
  52. node v22.19/web-globals/domexception.d.ts +68 -0
  53. node v22.19/web-globals/events.d.ts +97 -0
  54. node v22.19/web-globals/fetch.d.ts +46 -0
  55. node v22.19/web-globals/navigator.d.ts +22 -0
  56. node v22.19/web-globals/storage.d.ts +24 -0
  57. node/worker_threads.d.ts → node v22.19/worker_threads.d.ts +112 -74
  58. node/zlib.d.ts → node v22.19/zlib.d.ts +39 -26
  59. node/README.md +0 -15
  60. node/assert/strict.d.ts +0 -8
  61. node/dom-events.d.ts +0 -124
  62. node/globals.d.ts +0 -371
  63. node/globals.typedarray.d.ts +0 -21
  64. node/test.d.ts +0 -2280
  65. node/ts5.6/globals.typedarray.d.ts +0 -19
  66. {node → node v22.19}/LICENSE +0 -0
  67. node/async_hooks.d.ts → node v22.19/async_hooks.d.ts +1 -1
  68. {node → node v22.19}/compatibility/index.d.ts +0 -0
  69. {node → node v22.19}/console.d.ts +0 -0
  70. {node → node v22.19}/constants.d.ts +0 -0
  71. {node → node v22.19}/domain.d.ts +0 -0
  72. {node → node v22.19}/punycode.d.ts +0 -0
  73. {node → node v22.19}/querystring.d.ts +0 -0
  74. {node → node v22.19}/readline.d.ts +0 -0
  75. {node → node v22.19}/sea.d.ts +0 -0
  76. {node → node v22.19}/stream/promises.d.ts +0 -0
  77. {node → node v22.19}/timers/promises.d.ts +0 -0
  78. {node → node v22.19}/timers.d.ts +0 -0
  79. {node → node v22.19}/trace_events.d.ts +0 -0
  80. {node → node v22.19}/tty.d.ts +0 -0
@@ -92,6 +92,7 @@
92
92
  * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/zlib.js)
93
93
  */
94
94
  declare module "zlib" {
95
+ import { NonSharedBuffer } from "node:buffer";
95
96
  import * as stream from "node:stream";
96
97
  interface ZlibOptions {
97
98
  /**
@@ -147,6 +148,10 @@ declare module "zlib" {
147
148
  * @default buffer.kMaxLength
148
149
  */
149
150
  maxOutputLength?: number | undefined;
151
+ /**
152
+ * If `true`, returns an object with `buffer` and `engine`.
153
+ */
154
+ info?: boolean | undefined;
150
155
  }
151
156
  interface ZstdOptions {
152
157
  /**
@@ -172,6 +177,16 @@ declare module "zlib" {
172
177
  * @default buffer.kMaxLength
173
178
  */
174
179
  maxOutputLength?: number | undefined;
180
+ /**
181
+ * If `true`, returns an object with `buffer` and `engine`.
182
+ */
183
+ info?: boolean | undefined;
184
+ /**
185
+ * Optional dictionary used to improve compression efficiency when compressing or decompressing data that
186
+ * shares common patterns with the dictionary.
187
+ * @since v22.19.0
188
+ */
189
+ dictionary?: NodeJS.ArrayBufferView | undefined;
175
190
  }
176
191
  interface Zlib {
177
192
  /** @deprecated Use bytesWritten instead. */
@@ -215,7 +230,7 @@ declare module "zlib" {
215
230
  * @returns A 32-bit unsigned integer containing the checksum.
216
231
  * @since v22.2.0
217
232
  */
218
- function crc32(data: string | Buffer | NodeJS.ArrayBufferView, value?: number): number;
233
+ function crc32(data: string | NodeJS.ArrayBufferView, value?: number): number;
219
234
  /**
220
235
  * Creates and returns a new `BrotliCompress` object.
221
236
  * @since v11.7.0, v10.16.0
@@ -279,124 +294,124 @@ declare module "zlib" {
279
294
  */
280
295
  function createZstdDecompress(options?: ZstdOptions): ZstdDecompress;
281
296
  type InputType = string | ArrayBuffer | NodeJS.ArrayBufferView;
282
- type CompressCallback = (error: Error | null, result: Buffer) => void;
297
+ type CompressCallback = (error: Error | null, result: NonSharedBuffer) => void;
283
298
  /**
284
299
  * @since v11.7.0, v10.16.0
285
300
  */
286
301
  function brotliCompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void;
287
302
  function brotliCompress(buf: InputType, callback: CompressCallback): void;
288
303
  namespace brotliCompress {
289
- function __promisify__(buffer: InputType, options?: BrotliOptions): Promise<Buffer>;
304
+ function __promisify__(buffer: InputType, options?: BrotliOptions): Promise<NonSharedBuffer>;
290
305
  }
291
306
  /**
292
307
  * Compress a chunk of data with `BrotliCompress`.
293
308
  * @since v11.7.0, v10.16.0
294
309
  */
295
- function brotliCompressSync(buf: InputType, options?: BrotliOptions): Buffer;
310
+ function brotliCompressSync(buf: InputType, options?: BrotliOptions): NonSharedBuffer;
296
311
  /**
297
312
  * @since v11.7.0, v10.16.0
298
313
  */
299
314
  function brotliDecompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void;
300
315
  function brotliDecompress(buf: InputType, callback: CompressCallback): void;
301
316
  namespace brotliDecompress {
302
- function __promisify__(buffer: InputType, options?: BrotliOptions): Promise<Buffer>;
317
+ function __promisify__(buffer: InputType, options?: BrotliOptions): Promise<NonSharedBuffer>;
303
318
  }
304
319
  /**
305
320
  * Decompress a chunk of data with `BrotliDecompress`.
306
321
  * @since v11.7.0, v10.16.0
307
322
  */
308
- function brotliDecompressSync(buf: InputType, options?: BrotliOptions): Buffer;
323
+ function brotliDecompressSync(buf: InputType, options?: BrotliOptions): NonSharedBuffer;
309
324
  /**
310
325
  * @since v0.6.0
311
326
  */
312
327
  function deflate(buf: InputType, callback: CompressCallback): void;
313
328
  function deflate(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
314
329
  namespace deflate {
315
- function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
330
+ function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
316
331
  }
317
332
  /**
318
333
  * Compress a chunk of data with `Deflate`.
319
334
  * @since v0.11.12
320
335
  */
321
- function deflateSync(buf: InputType, options?: ZlibOptions): Buffer;
336
+ function deflateSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
322
337
  /**
323
338
  * @since v0.6.0
324
339
  */
325
340
  function deflateRaw(buf: InputType, callback: CompressCallback): void;
326
341
  function deflateRaw(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
327
342
  namespace deflateRaw {
328
- function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
343
+ function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
329
344
  }
330
345
  /**
331
346
  * Compress a chunk of data with `DeflateRaw`.
332
347
  * @since v0.11.12
333
348
  */
334
- function deflateRawSync(buf: InputType, options?: ZlibOptions): Buffer;
349
+ function deflateRawSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
335
350
  /**
336
351
  * @since v0.6.0
337
352
  */
338
353
  function gzip(buf: InputType, callback: CompressCallback): void;
339
354
  function gzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
340
355
  namespace gzip {
341
- function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
356
+ function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
342
357
  }
343
358
  /**
344
359
  * Compress a chunk of data with `Gzip`.
345
360
  * @since v0.11.12
346
361
  */
347
- function gzipSync(buf: InputType, options?: ZlibOptions): Buffer;
362
+ function gzipSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
348
363
  /**
349
364
  * @since v0.6.0
350
365
  */
351
366
  function gunzip(buf: InputType, callback: CompressCallback): void;
352
367
  function gunzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
353
368
  namespace gunzip {
354
- function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
369
+ function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
355
370
  }
356
371
  /**
357
372
  * Decompress a chunk of data with `Gunzip`.
358
373
  * @since v0.11.12
359
374
  */
360
- function gunzipSync(buf: InputType, options?: ZlibOptions): Buffer;
375
+ function gunzipSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
361
376
  /**
362
377
  * @since v0.6.0
363
378
  */
364
379
  function inflate(buf: InputType, callback: CompressCallback): void;
365
380
  function inflate(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
366
381
  namespace inflate {
367
- function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
382
+ function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
368
383
  }
369
384
  /**
370
385
  * Decompress a chunk of data with `Inflate`.
371
386
  * @since v0.11.12
372
387
  */
373
- function inflateSync(buf: InputType, options?: ZlibOptions): Buffer;
388
+ function inflateSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
374
389
  /**
375
390
  * @since v0.6.0
376
391
  */
377
392
  function inflateRaw(buf: InputType, callback: CompressCallback): void;
378
393
  function inflateRaw(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
379
394
  namespace inflateRaw {
380
- function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
395
+ function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
381
396
  }
382
397
  /**
383
398
  * Decompress a chunk of data with `InflateRaw`.
384
399
  * @since v0.11.12
385
400
  */
386
- function inflateRawSync(buf: InputType, options?: ZlibOptions): Buffer;
401
+ function inflateRawSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
387
402
  /**
388
403
  * @since v0.6.0
389
404
  */
390
405
  function unzip(buf: InputType, callback: CompressCallback): void;
391
406
  function unzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
392
407
  namespace unzip {
393
- function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
408
+ function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
394
409
  }
395
410
  /**
396
411
  * Decompress a chunk of data with `Unzip`.
397
412
  * @since v0.11.12
398
413
  */
399
- function unzipSync(buf: InputType, options?: ZlibOptions): Buffer;
414
+ function unzipSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
400
415
  /**
401
416
  * @since v22.15.0
402
417
  * @experimental
@@ -404,14 +419,14 @@ declare module "zlib" {
404
419
  function zstdCompress(buf: InputType, callback: CompressCallback): void;
405
420
  function zstdCompress(buf: InputType, options: ZstdOptions, callback: CompressCallback): void;
406
421
  namespace zstdCompress {
407
- function __promisify__(buffer: InputType, options?: ZstdOptions): Promise<Buffer>;
422
+ function __promisify__(buffer: InputType, options?: ZstdOptions): Promise<NonSharedBuffer>;
408
423
  }
409
424
  /**
410
425
  * Compress a chunk of data with `ZstdCompress`.
411
426
  * @since v22.15.0
412
427
  * @experimental
413
428
  */
414
- function zstdCompressSync(buf: InputType, options?: ZstdOptions): Buffer;
429
+ function zstdCompressSync(buf: InputType, options?: ZstdOptions): NonSharedBuffer;
415
430
  /**
416
431
  * @since v22.15.0
417
432
  * @experimental
@@ -419,14 +434,14 @@ declare module "zlib" {
419
434
  function zstdDecompress(buf: InputType, callback: CompressCallback): void;
420
435
  function zstdDecompress(buf: InputType, options: ZstdOptions, callback: CompressCallback): void;
421
436
  namespace zstdDecompress {
422
- function __promisify__(buffer: InputType, options?: ZstdOptions): Promise<Buffer>;
437
+ function __promisify__(buffer: InputType, options?: ZstdOptions): Promise<NonSharedBuffer>;
423
438
  }
424
439
  /**
425
440
  * Decompress a chunk of data with `ZstdDecompress`.
426
441
  * @since v22.15.0
427
442
  * @experimental
428
443
  */
429
- function zstdDecompressSync(buf: InputType, options?: ZstdOptions): Buffer;
444
+ function zstdDecompressSync(buf: InputType, options?: ZstdOptions): NonSharedBuffer;
430
445
  namespace constants {
431
446
  const BROTLI_DECODE: number;
432
447
  const BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: number;
@@ -612,8 +627,6 @@ declare module "zlib" {
612
627
  const Z_FINISH: number;
613
628
  /** @deprecated Use `constants.Z_BLOCK` */
614
629
  const Z_BLOCK: number;
615
- /** @deprecated Use `constants.Z_TREES` */
616
- const Z_TREES: number;
617
630
  // Return codes for the compression/decompression functions.
618
631
  // Negative values are errors, positive values are used for special but normal events.
619
632
  /** @deprecated Use `constants.Z_OK` */
node/README.md DELETED
@@ -1,15 +0,0 @@
1
- # Installation
2
- > `npm install --save @types/node`
3
-
4
- # Summary
5
- This package contains type definitions for node (https://nodejs.org/).
6
-
7
- # Details
8
- Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
9
-
10
- ### Additional Details
11
- * Last updated: Tue, 20 May 2025 23:02:19 GMT
12
- * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
-
14
- # Credits
15
- These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), [Matteo Collina](https://github.com/mcollina), [Dmitry Semigradsky](https://github.com/Semigradsky), and [René](https://github.com/Renegade334).
node/assert/strict.d.ts DELETED
@@ -1,8 +0,0 @@
1
- declare module "assert/strict" {
2
- import { strict } from "node:assert";
3
- export = strict;
4
- }
5
- declare module "node:assert/strict" {
6
- import { strict } from "node:assert";
7
- export = strict;
8
- }
node/dom-events.d.ts DELETED
@@ -1,124 +0,0 @@
1
- export {}; // Don't export anything!
2
-
3
- //// DOM-like Events
4
- // NB: The Event / EventTarget / EventListener implementations below were copied
5
- // from lib.dom.d.ts, then edited to reflect Node's documentation at
6
- // https://nodejs.org/api/events.html#class-eventtarget.
7
- // Please read that link to understand important implementation differences.
8
-
9
- // This conditional type will be the existing global Event in a browser, or
10
- // the copy below in a Node environment.
11
- type __Event = typeof globalThis extends { onmessage: any; Event: any } ? {}
12
- : {
13
- /** This is not used in Node.js and is provided purely for completeness. */
14
- readonly bubbles: boolean;
15
- /** Alias for event.stopPropagation(). This is not used in Node.js and is provided purely for completeness. */
16
- cancelBubble: () => void;
17
- /** True if the event was created with the cancelable option */
18
- readonly cancelable: boolean;
19
- /** This is not used in Node.js and is provided purely for completeness. */
20
- readonly composed: boolean;
21
- /** Returns an array containing the current EventTarget as the only entry or empty if the event is not being dispatched. This is not used in Node.js and is provided purely for completeness. */
22
- composedPath(): [EventTarget?];
23
- /** Alias for event.target. */
24
- readonly currentTarget: EventTarget | null;
25
- /** Is true if cancelable is true and event.preventDefault() has been called. */
26
- readonly defaultPrevented: boolean;
27
- /** This is not used in Node.js and is provided purely for completeness. */
28
- readonly eventPhase: 0 | 2;
29
- /** The `AbortSignal` "abort" event is emitted with `isTrusted` set to `true`. The value is `false` in all other cases. */
30
- readonly isTrusted: boolean;
31
- /** Sets the `defaultPrevented` property to `true` if `cancelable` is `true`. */
32
- preventDefault(): void;
33
- /** This is not used in Node.js and is provided purely for completeness. */
34
- returnValue: boolean;
35
- /** Alias for event.target. */
36
- readonly srcElement: EventTarget | null;
37
- /** Stops the invocation of event listeners after the current one completes. */
38
- stopImmediatePropagation(): void;
39
- /** This is not used in Node.js and is provided purely for completeness. */
40
- stopPropagation(): void;
41
- /** The `EventTarget` dispatching the event */
42
- readonly target: EventTarget | null;
43
- /** The millisecond timestamp when the Event object was created. */
44
- readonly timeStamp: number;
45
- /** Returns the type of event, e.g. "click", "hashchange", or "submit". */
46
- readonly type: string;
47
- };
48
-
49
- // See comment above explaining conditional type
50
- type __EventTarget = typeof globalThis extends { onmessage: any; EventTarget: any } ? {}
51
- : {
52
- /**
53
- * Adds a new handler for the `type` event. Any given `listener` is added only once per `type` and per `capture` option value.
54
- *
55
- * If the `once` option is true, the `listener` is removed after the next time a `type` event is dispatched.
56
- *
57
- * The `capture` option is not used by Node.js in any functional way other than tracking registered event listeners per the `EventTarget` specification.
58
- * Specifically, the `capture` option is used as part of the key when registering a `listener`.
59
- * Any individual `listener` may be added once with `capture = false`, and once with `capture = true`.
60
- */
61
- addEventListener(
62
- type: string,
63
- listener: EventListener | EventListenerObject,
64
- options?: AddEventListenerOptions | boolean,
65
- ): void;
66
- /** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */
67
- dispatchEvent(event: Event): boolean;
68
- /** Removes the event listener in target's event listener list with the same type, callback, and options. */
69
- removeEventListener(
70
- type: string,
71
- listener: EventListener | EventListenerObject,
72
- options?: EventListenerOptions | boolean,
73
- ): void;
74
- };
75
-
76
- interface EventInit {
77
- bubbles?: boolean;
78
- cancelable?: boolean;
79
- composed?: boolean;
80
- }
81
-
82
- interface EventListenerOptions {
83
- /** Not directly used by Node.js. Added for API completeness. Default: `false`. */
84
- capture?: boolean;
85
- }
86
-
87
- interface AddEventListenerOptions extends EventListenerOptions {
88
- /** When `true`, the listener is automatically removed when it is first invoked. Default: `false`. */
89
- once?: boolean;
90
- /** When `true`, serves as a hint that the listener will not call the `Event` object's `preventDefault()` method. Default: false. */
91
- passive?: boolean;
92
- /** The listener will be removed when the given AbortSignal object's `abort()` method is called. */
93
- signal?: AbortSignal;
94
- }
95
-
96
- interface EventListener {
97
- (evt: Event): void;
98
- }
99
-
100
- interface EventListenerObject {
101
- handleEvent(object: Event): void;
102
- }
103
-
104
- import {} from "events"; // Make this an ambient declaration
105
- declare global {
106
- /** An event which takes place in the DOM. */
107
- interface Event extends __Event {}
108
- var Event: typeof globalThis extends { onmessage: any; Event: infer T } ? T
109
- : {
110
- prototype: __Event;
111
- new(type: string, eventInitDict?: EventInit): __Event;
112
- };
113
-
114
- /**
115
- * EventTarget is a DOM interface implemented by objects that can
116
- * receive events and may have listeners for them.
117
- */
118
- interface EventTarget extends __EventTarget {}
119
- var EventTarget: typeof globalThis extends { onmessage: any; EventTarget: infer T } ? T
120
- : {
121
- prototype: __EventTarget;
122
- new(): __EventTarget;
123
- };
124
- }