@types/node 16.18.113 → 16.18.114

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 v16.18/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/v16.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Mon, 07 Oct 2024 22:07:58 GMT
11
+ * Last updated: Wed, 16 Oct 2024 23:36:24 GMT
12
12
  * Dependencies: none
13
13
 
14
14
  # Credits
@@ -0,0 +1,8 @@
1
+ // Declaration files in this directory contain types relating to TypeScript library features
2
+ // that are not included in all TypeScript versions supported by DefinitelyTyped, but
3
+ // which can be made backwards-compatible without needing `typesVersions`.
4
+ // If adding declarations to this directory, please specify which versions of TypeScript require them,
5
+ // so that they can be removed when no longer needed.
6
+
7
+ /// <reference path="indexable.d.ts" />
8
+ /// <reference path="iterators.d.ts" />
@@ -0,0 +1,20 @@
1
+ // Polyfill for ES2022's .at() method on string/array prototypes, added to TypeScript in 4.6.
2
+
3
+ interface RelativeIndexable<T> {
4
+ at(index: number): T | undefined;
5
+ }
6
+
7
+ interface String extends RelativeIndexable<string> {}
8
+ interface Array<T> extends RelativeIndexable<T> {}
9
+ interface ReadonlyArray<T> extends RelativeIndexable<T> {}
10
+ interface Int8Array extends RelativeIndexable<number> {}
11
+ interface Uint8Array extends RelativeIndexable<number> {}
12
+ interface Uint8ClampedArray extends RelativeIndexable<number> {}
13
+ interface Int16Array extends RelativeIndexable<number> {}
14
+ interface Uint16Array extends RelativeIndexable<number> {}
15
+ interface Int32Array extends RelativeIndexable<number> {}
16
+ interface Uint32Array extends RelativeIndexable<number> {}
17
+ interface Float32Array extends RelativeIndexable<number> {}
18
+ interface Float64Array extends RelativeIndexable<number> {}
19
+ interface BigInt64Array extends RelativeIndexable<bigint> {}
20
+ interface BigUint64Array extends RelativeIndexable<bigint> {}
@@ -0,0 +1,20 @@
1
+ // Backwards-compatible iterator interfaces, augmented with iterator helper methods by lib.esnext.iterator in TypeScript 5.6.
2
+ // The IterableIterator interface does not contain these methods, which creates assignability issues in places where IteratorObjects
3
+ // are expected (eg. DOM-compatible APIs) if lib.esnext.iterator is loaded.
4
+ // Also ensures that iterators returned by the Node API, which inherit from Iterator.prototype, correctly expose the iterator helper methods
5
+ // if lib.esnext.iterator is loaded.
6
+
7
+ // Placeholders for TS <5.6
8
+ interface IteratorObject<T, TReturn, TNext> {}
9
+ interface AsyncIteratorObject<T, TReturn, TNext> {}
10
+
11
+ declare namespace NodeJS {
12
+ // Populate iterator methods for TS <5.6
13
+ interface Iterator<T, TReturn, TNext> extends globalThis.Iterator<T, TReturn, TNext> {}
14
+ interface AsyncIterator<T, TReturn, TNext> extends globalThis.AsyncIterator<T, TReturn, TNext> {}
15
+
16
+ // Polyfill for TS 5.6's instrinsic BuiltinIteratorReturn type, required for DOM-compatible iterators
17
+ type BuiltinIteratorReturn = ReturnType<any[][typeof Symbol.iterator]> extends
18
+ globalThis.Iterator<any, infer TReturn> ? TReturn
19
+ : any;
20
+ }
node v16.18/events.d.ts CHANGED
@@ -243,7 +243,7 @@ declare module "events" {
243
243
  emitter: NodeJS.EventEmitter,
244
244
  eventName: string,
245
245
  options?: StaticEventEmitterOptions,
246
- ): AsyncIterableIterator<any>;
246
+ ): NodeJS.AsyncIterator<any>;
247
247
  /**
248
248
  * A class method that returns the number of listeners for the given `eventName`registered on the given `emitter`.
249
249
  *
node v16.18/fs.d.ts CHANGED
@@ -215,7 +215,7 @@ declare module "fs" {
215
215
  /**
216
216
  * Asynchronously iterates over the directory via `readdir(3)` until all entries have been read.
217
217
  */
218
- [Symbol.asyncIterator](): AsyncIterableIterator<Dirent>;
218
+ [Symbol.asyncIterator](): NodeJS.AsyncIterator<Dirent>;
219
219
  /**
220
220
  * Asynchronously close the directory's underlying resource handle.
221
221
  * Subsequent reads will result in errors.
@@ -27,6 +27,8 @@ interface NodeModule extends NodeJS.Module {}
27
27
  declare var process: NodeJS.Process;
28
28
  declare var console: Console;
29
29
 
30
+ declare var global: typeof globalThis;
31
+
30
32
  declare var __filename: string;
31
33
  declare var __dirname: string;
32
34
 
@@ -82,31 +84,6 @@ declare var AbortSignal: typeof globalThis extends { onmessage: any; AbortSignal
82
84
  };
83
85
  // #endregion borrowed
84
86
 
85
- // #region ArrayLike.at()
86
- interface RelativeIndexable<T> {
87
- /**
88
- * Takes an integer value and returns the item at that index,
89
- * allowing for positive and negative integers.
90
- * Negative integers count back from the last item in the array.
91
- */
92
- at(index: number): T | undefined;
93
- }
94
- interface String extends RelativeIndexable<string> {}
95
- interface Array<T> extends RelativeIndexable<T> {}
96
- interface ReadonlyArray<T> extends RelativeIndexable<T> {}
97
- interface Int8Array extends RelativeIndexable<number> {}
98
- interface Uint8Array extends RelativeIndexable<number> {}
99
- interface Uint8ClampedArray extends RelativeIndexable<number> {}
100
- interface Int16Array extends RelativeIndexable<number> {}
101
- interface Uint16Array extends RelativeIndexable<number> {}
102
- interface Int32Array extends RelativeIndexable<number> {}
103
- interface Uint32Array extends RelativeIndexable<number> {}
104
- interface Float32Array extends RelativeIndexable<number> {}
105
- interface Float64Array extends RelativeIndexable<number> {}
106
- interface BigInt64Array extends RelativeIndexable<bigint> {}
107
- interface BigUint64Array extends RelativeIndexable<bigint> {}
108
- // #endregion ArrayLike.at() end
109
-
110
87
  /*----------------------------------------------*
111
88
  * *
112
89
  * GLOBAL INTERFACES *
@@ -205,7 +182,7 @@ declare namespace NodeJS {
205
182
  unpipe(destination?: WritableStream): this;
206
183
  unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
207
184
  wrap(oldStream: ReadableStream): this;
208
- [Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
185
+ [Symbol.asyncIterator](): NodeJS.AsyncIterator<string | Buffer>;
209
186
  }
210
187
 
211
188
  interface WritableStream extends EventEmitter {
@@ -274,4 +251,16 @@ declare namespace NodeJS {
274
251
  interface ReadOnlyDict<T> {
275
252
  readonly [key: string]: T | undefined;
276
253
  }
254
+
255
+ /** An iterable iterator returned by the Node.js API. */
256
+ // Default TReturn/TNext in v16 is `any`, for compatibility with the previously-used IterableIterator.
257
+ interface Iterator<T, TReturn = any, TNext = any> extends IteratorObject<T, TReturn, TNext> {
258
+ [Symbol.iterator](): NodeJS.Iterator<T, TReturn, TNext>;
259
+ }
260
+
261
+ /** An async iterable iterator returned by the Node.js API. */
262
+ // Default TReturn/TNext in v16 is `any`, for compatibility with the previously-used AsyncIterableIterator.
263
+ interface AsyncIterator<T, TReturn = any, TNext = any> extends AsyncIteratorObject<T, TReturn, TNext> {
264
+ [Symbol.asyncIterator](): NodeJS.AsyncIterator<T, TReturn, TNext>;
265
+ }
277
266
  }
node v16.18/index.d.ts CHANGED
@@ -22,22 +22,22 @@
22
22
  * IN THE SOFTWARE.
23
23
  */
24
24
 
25
- // NOTE: These definitions support NodeJS and TypeScript 5.7+.
25
+ // NOTE: These definitions support Node.js and TypeScript 5.7+.
26
26
 
27
- // Reference required types from the default lib:
27
+ // Reference required TypeScript libs:
28
28
  /// <reference lib="es2020" />
29
- /// <reference lib="esnext.asynciterable" />
30
- /// <reference lib="esnext.intl" />
31
- /// <reference lib="esnext.bigint" />
32
29
 
33
- // Definitions specific to TypeScript 5.7+
30
+ // TypeScript backwards-compatibility definitions:
31
+ /// <reference path="compatibility/index.d.ts" />
32
+
33
+ // Definitions specific to TypeScript 5.7+:
34
34
  /// <reference path="globals.typedarray.d.ts" />
35
35
  /// <reference path="buffer.buffer.d.ts" />
36
36
 
37
- // Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
37
+ // Definitions for Node.js modules that are not specific to any version of TypeScript:
38
+ /// <reference path="globals.d.ts" />
38
39
  /// <reference path="assert.d.ts" />
39
40
  /// <reference path="assert/strict.d.ts" />
40
- /// <reference path="globals.d.ts" />
41
41
  /// <reference path="async_hooks.d.ts" />
42
42
  /// <reference path="buffer.d.ts" />
43
43
  /// <reference path="child_process.d.ts" />
@@ -86,5 +86,3 @@
86
86
  /// <reference path="wasi.d.ts" />
87
87
  /// <reference path="worker_threads.d.ts" />
88
88
  /// <reference path="zlib.d.ts" />
89
-
90
- /// <reference path="globals.global.d.ts" />
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "16.18.113",
3
+ "version": "16.18.114",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -217,6 +217,6 @@
217
217
  },
218
218
  "scripts": {},
219
219
  "dependencies": {},
220
- "typesPublisherContentHash": "1e0f18d2dfeb3fd68763b84d37a7c2dc4a5f7bd87a74300d4179ed6538be4477",
220
+ "typesPublisherContentHash": "72c1ffba5c5f5cd85ebe5326dd9c6fea84da72d1638c5e9d731f17abb774fd90",
221
221
  "typeScriptVersion": "4.8"
222
222
  }
@@ -314,7 +314,7 @@ declare module "readline" {
314
314
  prependOnceListener(event: "SIGINT", listener: () => void): this;
315
315
  prependOnceListener(event: "SIGTSTP", listener: () => void): this;
316
316
  prependOnceListener(event: "history", listener: (history: string[]) => void): this;
317
- [Symbol.asyncIterator](): AsyncIterableIterator<string>;
317
+ [Symbol.asyncIterator](): NodeJS.AsyncIterator<string>;
318
318
  }
319
319
  type ReadLine = Interface; // type forwarded for backwards compatibility
320
320
  type Completer = (line: string) => CompleterResult;
@@ -154,6 +154,10 @@ declare module "stream/web" {
154
154
  (reason: any): void | PromiseLike<void>;
155
155
  }
156
156
 
157
+ interface ReadableStreamAsyncIterator<T> extends NodeJS.AsyncIterator<T, NodeJS.BuiltinIteratorReturn, unknown> {
158
+ [Symbol.asyncIterator](): ReadableStreamAsyncIterator<T>;
159
+ }
160
+
157
161
  /** This Streams API interface represents a readable stream of byte data. */
158
162
  interface ReadableStream<R = any> {
159
163
  readonly locked: boolean;
@@ -162,8 +166,8 @@ declare module "stream/web" {
162
166
  pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;
163
167
  pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;
164
168
  tee(): [ReadableStream<R>, ReadableStream<R>];
165
- values(options?: { preventCancel?: boolean }): AsyncIterableIterator<R>;
166
- [Symbol.asyncIterator](): AsyncIterableIterator<R>;
169
+ values(options?: { preventCancel?: boolean }): ReadableStreamAsyncIterator<R>;
170
+ [Symbol.asyncIterator](): ReadableStreamAsyncIterator<R>;
167
171
  }
168
172
 
169
173
  const ReadableStream: {
node v16.18/stream.d.ts CHANGED
@@ -412,7 +412,7 @@ declare module "stream" {
412
412
  * or exiting a `for await...of` iteration using a `break`, `return`, or `throw` will not destroy the stream.
413
413
  * **Default: `true`**.
414
414
  */
415
- iterator(options?: { destroyOnReturn?: boolean }): AsyncIterableIterator<any>;
415
+ iterator(options?: { destroyOnReturn?: boolean }): NodeJS.AsyncIterator<any>;
416
416
  /**
417
417
  * This method allows mapping over the stream. The *fn* function will be called for every chunk in the stream.
418
418
  * If the *fn* function returns a promise - that promise will be `await`ed before being passed to the result stream.
@@ -513,7 +513,7 @@ declare module "stream" {
513
513
  removeListener(event: "readable", listener: () => void): this;
514
514
  removeListener(event: "resume", listener: () => void): this;
515
515
  removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
516
- [Symbol.asyncIterator](): AsyncIterableIterator<any>;
516
+ [Symbol.asyncIterator](): NodeJS.AsyncIterator<any>;
517
517
  }
518
518
  interface WritableOptions extends StreamOptions<Writable> {
519
519
  decodeStrings?: boolean | undefined;
@@ -22,22 +22,22 @@
22
22
  * IN THE SOFTWARE.
23
23
  */
24
24
 
25
- // NOTE: These definitions support NodeJS and TypeScript 4.9 through 5.6.
25
+ // NOTE: These definitions support Node.js and TypeScript 4.9 through 5.6.
26
26
 
27
- // Reference required types from the default lib:
27
+ // Reference required TypeScript libs:
28
28
  /// <reference lib="es2020" />
29
- /// <reference lib="esnext.asynciterable" />
30
- /// <reference lib="esnext.intl" />
31
- /// <reference lib="esnext.bigint" />
32
29
 
33
- // Definitions specific to TypeScript 4.9 through 5.6
30
+ // TypeScript backwards-compatibility definitions:
31
+ /// <reference path="../compatibility/index.d.ts" />
32
+
33
+ // Definitions specific to TypeScript 4.9 through 5.6:
34
34
  /// <reference path="./globals.typedarray.d.ts" />
35
35
  /// <reference path="./buffer.buffer.d.ts" />
36
36
 
37
- // Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
37
+ // Definitions for Node.js modules that are not specific to any version of TypeScript:
38
+ /// <reference path="../globals.d.ts" />
38
39
  /// <reference path="../assert.d.ts" />
39
40
  /// <reference path="../assert/strict.d.ts" />
40
- /// <reference path="../globals.d.ts" />
41
41
  /// <reference path="../async_hooks.d.ts" />
42
42
  /// <reference path="../buffer.d.ts" />
43
43
  /// <reference path="../child_process.d.ts" />
@@ -86,5 +86,3 @@
86
86
  /// <reference path="../wasi.d.ts" />
87
87
  /// <reference path="../worker_threads.d.ts" />
88
88
  /// <reference path="../zlib.d.ts" />
89
-
90
- /// <reference path="../globals.global.d.ts" />
node v16.18/url.d.ts CHANGED
@@ -687,6 +687,9 @@ declare module "url" {
687
687
  */
688
688
  toJSON(): string;
689
689
  }
690
+ interface URLSearchParamsIterator<T> extends NodeJS.Iterator<T, NodeJS.BuiltinIteratorReturn, unknown> {
691
+ [Symbol.iterator](): URLSearchParamsIterator<T>;
692
+ }
690
693
  /**
691
694
  * The `URLSearchParams` API provides read and write access to the query of a `URL`. The `URLSearchParams` class can also be used standalone with one of the
692
695
  * four following constructors.
@@ -755,7 +758,7 @@ declare module "url" {
755
758
  *
756
759
  * Alias for `urlSearchParams[@@iterator]()`.
757
760
  */
758
- entries(): IterableIterator<[string, string]>;
761
+ entries(): URLSearchParamsIterator<[string, string]>;
759
762
  /**
760
763
  * Iterates over each name-value pair in the query and invokes the given function.
761
764
  *
@@ -803,7 +806,7 @@ declare module "url" {
803
806
  * // foo
804
807
  * ```
805
808
  */
806
- keys(): IterableIterator<string>;
809
+ keys(): URLSearchParamsIterator<string>;
807
810
  /**
808
811
  * Sets the value in the `URLSearchParams` object associated with `name` to`value`. If there are any pre-existing name-value pairs whose names are `name`,
809
812
  * set the first such pair's value to `value` and remove all others. If not,
@@ -848,8 +851,8 @@ declare module "url" {
848
851
  /**
849
852
  * Returns an ES6 `Iterator` over the values of each name-value pair.
850
853
  */
851
- values(): IterableIterator<string>;
852
- [Symbol.iterator](): IterableIterator<[string, string]>;
854
+ values(): URLSearchParamsIterator<string>;
855
+ [Symbol.iterator](): URLSearchParamsIterator<[string, string]>;
853
856
  }
854
857
 
855
858
  import { URL as _URL, URLSearchParams as _URLSearchParams } from "url";
@@ -1 +0,0 @@
1
- declare var global: typeof globalThis;