@types/node 22.3.0 → 22.4.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.
node/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.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Wed, 14 Aug 2024 07:35:57 GMT
11
+ * Last updated: Mon, 19 Aug 2024 02:45:10 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
node/globals.d.ts CHANGED
@@ -103,6 +103,84 @@ declare global {
103
103
  };
104
104
  // #endregion borrowed
105
105
 
106
+ // #region Storage
107
+ /**
108
+ * This Web Storage API interface provides access to a particular domain's session or local storage. It allows, for example, the addition, modification, or deletion of stored data items.
109
+ *
110
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage)
111
+ */
112
+ interface Storage {
113
+ /**
114
+ * Returns the number of key/value pairs.
115
+ *
116
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/length)
117
+ */
118
+ readonly length: number;
119
+ /**
120
+ * Removes all key/value pairs, if there are any.
121
+ *
122
+ * Dispatches a storage event on Window objects holding an equivalent Storage object.
123
+ *
124
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/clear)
125
+ */
126
+ clear(): void;
127
+ /**
128
+ * Returns the current value associated with the given key, or null if the given key does not exist.
129
+ *
130
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/getItem)
131
+ */
132
+ getItem(key: string): string | null;
133
+ /**
134
+ * Returns the name of the nth key, or null if n is greater than or equal to the number of key/value pairs.
135
+ *
136
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/key)
137
+ */
138
+ key(index: number): string | null;
139
+ /**
140
+ * Removes the key/value pair with the given key, if a key/value pair with the given key exists.
141
+ *
142
+ * Dispatches a storage event on Window objects holding an equivalent Storage object.
143
+ *
144
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/removeItem)
145
+ */
146
+ removeItem(key: string): void;
147
+ /**
148
+ * Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously.
149
+ *
150
+ * Throws a "QuotaExceededError" DOMException exception if the new value couldn't be set. (Setting could fail if, e.g., the user has disabled storage for the site, or if the quota has been exceeded.)
151
+ *
152
+ * Dispatches a storage event on Window objects holding an equivalent Storage object.
153
+ *
154
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/setItem)
155
+ */
156
+ setItem(key: string, value: string): void;
157
+ }
158
+
159
+ var Storage: typeof globalThis extends { onmessage: any; Storage: infer T } ? T
160
+ : {
161
+ prototype: Storage;
162
+ new(): Storage;
163
+ };
164
+
165
+ /**
166
+ * A browser-compatible implementation of [`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage).
167
+ * Data is stored unencrypted in the file specified by the `--localstorage-file` CLI flag.
168
+ * Any modification of this data outside of the Web Storage API is not supported.
169
+ * Enable this API with the `--experimental-webstorage` CLI flag.
170
+ * @since v22.4.0
171
+ */
172
+ var localStorage: Storage;
173
+
174
+ /**
175
+ * A browser-compatible implementation of [`sessionStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage).
176
+ * Data is stored in memory, with a storage quota of 10 MB.
177
+ * Any modification of this data outside of the Web Storage API is not supported.
178
+ * Enable this API with the `--experimental-webstorage` CLI flag.
179
+ * @since v22.4.0
180
+ */
181
+ var sessionStorage: Storage;
182
+ // #endregion Storage
183
+
106
184
  // #region Disposable
107
185
  interface SymbolConstructor {
108
186
  /**
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "22.3.0",
3
+ "version": "22.4.1",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -210,8 +210,8 @@
210
210
  },
211
211
  "scripts": {},
212
212
  "dependencies": {
213
- "undici-types": "~6.18.2"
213
+ "undici-types": "~6.19.2"
214
214
  },
215
- "typesPublisherContentHash": "620b8a407d4118e9931ab6e01ed7af87ce13d63daa46a4098fca6d43eaf853db",
215
+ "typesPublisherContentHash": "ccc9f99822466307487be499b4c3c04a1a5f42f97b354a1afa5584dfa95e982d",
216
216
  "typeScriptVersion": "4.8"
217
217
  }
node/process.d.ts CHANGED
@@ -322,24 +322,28 @@ declare module "process" {
322
322
  has(scope: string, reference?: string): boolean;
323
323
  }
324
324
  interface ProcessReport {
325
+ /**
326
+ * Write reports in a compact format, single-line JSON, more easily consumable by log processing systems
327
+ * than the default multi-line format designed for human consumption.
328
+ * @since v13.12.0, v12.17.0
329
+ */
330
+ compact: boolean;
325
331
  /**
326
332
  * Directory where the report is written.
333
+ * The default value is the empty string, indicating that reports are written to the current
327
334
  * working directory of the Node.js process.
328
- * @default '' indicating that reports are written to the current
329
335
  */
330
336
  directory: string;
331
337
  /**
332
- * Filename where the report is written.
333
- * The default value is the empty string.
334
- * @default '' the output filename will be comprised of a timestamp,
335
- * PID, and sequence number.
338
+ * Filename where the report is written. If set to the empty string, the output filename will be comprised
339
+ * of a timestamp, PID, and sequence number. The default value is the empty string.
336
340
  */
337
341
  filename: string;
338
342
  /**
339
- * Returns a JSON-formatted diagnostic report for the running process.
340
- * The report's JavaScript stack trace is taken from err, if present.
343
+ * Returns a JavaScript Object representation of a diagnostic report for the running process.
344
+ * The report's JavaScript stack trace is taken from `err`, if present.
341
345
  */
342
- getReport(err?: Error): string;
346
+ getReport(err?: Error): object;
343
347
  /**
344
348
  * If true, a diagnostic report is generated on fatal errors,
345
349
  * such as out of memory errors or failed C++ assertions.
@@ -365,18 +369,19 @@ declare module "process" {
365
369
  /**
366
370
  * Writes a diagnostic report to a file. If filename is not provided, the default filename
367
371
  * includes the date, time, PID, and a sequence number.
368
- * The report's JavaScript stack trace is taken from err, if present.
372
+ * The report's JavaScript stack trace is taken from `err`, if present.
369
373
  *
374
+ * If the value of filename is set to `'stdout'` or `'stderr'`, the report is written
375
+ * to the stdout or stderr of the process respectively.
370
376
  * @param fileName Name of the file where the report is written.
371
377
  * This should be a relative path, that will be appended to the directory specified in
372
378
  * `process.report.directory`, or the current working directory of the Node.js process,
373
379
  * if unspecified.
374
- * @param error A custom error used for reporting the JavaScript stack.
380
+ * @param err A custom error used for reporting the JavaScript stack.
375
381
  * @return Filename of the generated report.
376
382
  */
377
- writeReport(fileName?: string): string;
378
- writeReport(error?: Error): string;
379
383
  writeReport(fileName?: string, err?: Error): string;
384
+ writeReport(err?: Error): string;
380
385
  }
381
386
  interface ResourceUsage {
382
387
  fsRead: number;
@@ -1704,11 +1709,11 @@ declare module "process" {
1704
1709
  */
1705
1710
  allowedNodeEnvironmentFlags: ReadonlySet<string>;
1706
1711
  /**
1707
- * `process.report` is an object whose methods are used to generate diagnostic
1708
- * reports for the current process. Additional documentation is available in the `report documentation`.
1712
+ * `process.report` is an object whose methods are used to generate diagnostic reports for the current process.
1713
+ * Additional documentation is available in the [report documentation](https://nodejs.org/docs/latest-v22.x/api/report.html).
1709
1714
  * @since v11.8.0
1710
1715
  */
1711
- report?: ProcessReport | undefined;
1716
+ report: ProcessReport;
1712
1717
  /**
1713
1718
  * ```js
1714
1719
  * import { resourceUsage } from 'node:process';
node/test.d.ts CHANGED
@@ -1960,31 +1960,47 @@ declare module "node:test/reporters" {
1960
1960
  | { type: "test:watch:drained"; data: undefined };
1961
1961
  type TestEventGenerator = AsyncGenerator<TestEvent, void>;
1962
1962
 
1963
+ interface ReporterConstructorWrapper<T extends new(...args: any[]) => Transform> {
1964
+ new(...args: ConstructorParameters<T>): InstanceType<T>;
1965
+ (...args: ConstructorParameters<T>): InstanceType<T>;
1966
+ }
1967
+
1963
1968
  /**
1964
1969
  * The `dot` reporter outputs the test results in a compact format,
1965
1970
  * where each passing test is represented by a `.`,
1966
1971
  * and each failing test is represented by a `X`.
1972
+ * @since v20.0.0
1967
1973
  */
1968
1974
  function dot(source: TestEventGenerator): AsyncGenerator<"\n" | "." | "X", void>;
1969
1975
  /**
1970
1976
  * The `tap` reporter outputs the test results in the [TAP](https://testanything.org/) format.
1977
+ * @since v20.0.0
1971
1978
  */
1972
1979
  function tap(source: TestEventGenerator): AsyncGenerator<string, void>;
1980
+ class SpecReporter extends Transform {
1981
+ constructor();
1982
+ }
1973
1983
  /**
1974
1984
  * The `spec` reporter outputs the test results in a human-readable format.
1985
+ * @since v20.0.0
1975
1986
  */
1976
- class Spec extends Transform {
1977
- constructor();
1978
- }
1987
+ const spec: ReporterConstructorWrapper<typeof SpecReporter>;
1979
1988
  /**
1980
1989
  * The `junit` reporter outputs test results in a jUnit XML format.
1990
+ * @since v21.0.0
1981
1991
  */
1982
1992
  function junit(source: TestEventGenerator): AsyncGenerator<string, void>;
1993
+ class LcovReporter extends Transform {
1994
+ constructor(opts?: Omit<TransformOptions, "writableObjectMode">);
1995
+ }
1983
1996
  /**
1984
- * The `lcov` reporter outputs test coverage when used with the [`--experimental-test-coverage`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--experimental-test-coverage) flag.
1997
+ * The `lcov` reporter outputs test coverage when used with the
1998
+ * [`--experimental-test-coverage`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--experimental-test-coverage) flag.
1999
+ * @since v22.0.0
1985
2000
  */
1986
- class Lcov extends Transform {
1987
- constructor(opts?: TransformOptions);
1988
- }
1989
- export { dot, junit, Lcov as lcov, Spec as spec, tap, TestEvent };
2001
+ // TODO: change the export to a wrapper function once node@0db38f0 is merged (breaking change)
2002
+ // const lcov: ReporterConstructorWrapper<typeof LcovReporter>;
2003
+ const lcov: LcovReporter;
2004
+
2005
+ export { dot, junit, lcov, spec, tap, TestEvent };
1990
2006
  }
node/tls.d.ts CHANGED
@@ -843,6 +843,7 @@ declare module "tls" {
843
843
  ciphers?: string | undefined;
844
844
  /**
845
845
  * Name of an OpenSSL engine which can provide the client certificate.
846
+ * @deprecated
846
847
  */
847
848
  clientCertEngine?: string | undefined;
848
849
  /**
@@ -885,12 +886,14 @@ declare module "tls" {
885
886
  /**
886
887
  * Name of an OpenSSL engine to get private key from. Should be used
887
888
  * together with privateKeyIdentifier.
889
+ * @deprecated
888
890
  */
889
891
  privateKeyEngine?: string | undefined;
890
892
  /**
891
893
  * Identifier of a private key managed by an OpenSSL engine. Should be
892
894
  * used together with privateKeyEngine. Should not be set together with
893
895
  * key, because both options define a private key in different ways.
896
+ * @deprecated
894
897
  */
895
898
  privateKeyIdentifier?: string | undefined;
896
899
  /**
node/util.d.ts CHANGED
@@ -1480,6 +1480,12 @@ declare module "util" {
1480
1480
  * Whether this command accepts positional arguments.
1481
1481
  */
1482
1482
  allowPositionals?: boolean | undefined;
1483
+ /**
1484
+ * If `true`, allows explicitly setting boolean options to `false` by prefixing the option name with `--no-`.
1485
+ * @default false
1486
+ * @since v22.4.0
1487
+ */
1488
+ allowNegative?: boolean | undefined;
1483
1489
  /**
1484
1490
  * Return the parsed tokens. This is useful for extending the built-in behavior,
1485
1491
  * from adding additional checks through to reprocessing the tokens in different ways.