@types/node 18.19.103 → 18.19.105

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: Tue, 20 May 2025 23:02:19 GMT
11
+ * Last updated: Wed, 28 May 2025 17:35:19 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
@@ -1,77 +1,45 @@
1
- export {}; // Don't export anything!
1
+ // Make this a module
2
+ export {};
2
3
 
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.
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.
8
6
 
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
- };
7
+ type __Event = typeof globalThis extends { onmessage: any } ? {} : Event;
8
+ interface Event {
9
+ readonly bubbles: boolean;
10
+ cancelBubble: boolean;
11
+ readonly cancelable: boolean;
12
+ readonly composed: boolean;
13
+ composedPath(): [EventTarget?];
14
+ readonly currentTarget: EventTarget | null;
15
+ readonly defaultPrevented: boolean;
16
+ readonly eventPhase: 0 | 2;
17
+ initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void;
18
+ readonly isTrusted: boolean;
19
+ preventDefault(): void;
20
+ readonly returnValue: boolean;
21
+ readonly srcElement: EventTarget | null;
22
+ stopImmediatePropagation(): void;
23
+ stopPropagation(): void;
24
+ readonly target: EventTarget | null;
25
+ readonly timeStamp: number;
26
+ readonly type: string;
27
+ }
48
28
 
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
- };
29
+ type __EventTarget = typeof globalThis extends { onmessage: any } ? {} : EventTarget;
30
+ interface EventTarget {
31
+ addEventListener(
32
+ type: string,
33
+ listener: EventListener | EventListenerObject,
34
+ options?: AddEventListenerOptions | boolean,
35
+ ): void;
36
+ dispatchEvent(event: Event): boolean;
37
+ removeEventListener(
38
+ type: string,
39
+ listener: EventListener | EventListenerObject,
40
+ options?: EventListenerOptions | boolean,
41
+ ): void;
42
+ }
75
43
 
76
44
  interface EventInit {
77
45
  bubbles?: boolean;
@@ -80,16 +48,12 @@ interface EventInit {
80
48
  }
81
49
 
82
50
  interface EventListenerOptions {
83
- /** Not directly used by Node.js. Added for API completeness. Default: `false`. */
84
51
  capture?: boolean;
85
52
  }
86
53
 
87
54
  interface AddEventListenerOptions extends EventListenerOptions {
88
- /** When `true`, the listener is automatically removed when it is first invoked. Default: `false`. */
89
55
  once?: boolean;
90
- /** When `true`, serves as a hint that the listener will not call the `Event` object's `preventDefault()` method. Default: false. */
91
56
  passive?: boolean;
92
- /** The listener will be removed when the given AbortSignal object's `abort()` method is called. */
93
57
  signal?: AbortSignal;
94
58
  }
95
59
 
@@ -101,24 +65,19 @@ interface EventListenerObject {
101
65
  handleEvent(object: Event): void;
102
66
  }
103
67
 
104
- import {} from "events"; // Make this an ambient declaration
68
+ // Merge conditional interfaces into global scope, and conditionally declare global constructors.
105
69
  declare global {
106
- /** An event which takes place in the DOM. */
107
70
  interface Event extends __Event {}
108
71
  var Event: typeof globalThis extends { onmessage: any; Event: infer T } ? T
109
72
  : {
110
- prototype: __Event;
111
- new(type: string, eventInitDict?: EventInit): __Event;
73
+ prototype: Event;
74
+ new(type: string, eventInitDict?: EventInit): Event;
112
75
  };
113
76
 
114
- /**
115
- * EventTarget is a DOM interface implemented by objects that can
116
- * receive events and may have listeners for them.
117
- */
118
77
  interface EventTarget extends __EventTarget {}
119
78
  var EventTarget: typeof globalThis extends { onmessage: any; EventTarget: infer T } ? T
120
79
  : {
121
- prototype: __EventTarget;
122
- new(): __EventTarget;
80
+ prototype: EventTarget;
81
+ new(): EventTarget;
123
82
  };
124
83
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "18.19.103",
3
+ "version": "18.19.105",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -220,6 +220,6 @@
220
220
  "undici-types": "~5.26.4"
221
221
  },
222
222
  "peerDependencies": {},
223
- "typesPublisherContentHash": "36cc163a714c3c02e0a23c8c0790967714becf8bd1759bd74c8a5016c03df244",
223
+ "typesPublisherContentHash": "1a2b14ecb35dbc8050f834cdd21087a8b6740cf2f9d098a9fbd700611966d6de",
224
224
  "typeScriptVersion": "5.1"
225
225
  }
node v18.19/stream.d.ts CHANGED
@@ -729,6 +729,12 @@ declare module "stream" {
729
729
  * @since v11.4.0
730
730
  */
731
731
  readonly writable: boolean;
732
+ /**
733
+ * Returns whether the stream was destroyed or errored before emitting `'finish'`.
734
+ * @since v18.0.0, v16.17.0
735
+ * @experimental
736
+ */
737
+ readonly writableAborted: boolean;
732
738
  /**
733
739
  * Is `true` after `writable.end()` has been called. This property
734
740
  * does not indicate whether the data has been flushed, for this use `writable.writableFinished` instead.