Skip to content

Commit 569bc17

Browse files
authored
🤖 Merge PR DefinitelyTyped#74412 node: v25.2 by @Renegade334
1 parent a6d6651 commit 569bc17

18 files changed

+205
-127
lines changed

types/node/child_process.d.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*
66
* ```js
77
* import { spawn } from 'node:child_process';
8+
* import { once } from 'node:events';
89
* const ls = spawn('ls', ['-lh', '/usr']);
910
*
1011
* ls.stdout.on('data', (data) => {
@@ -15,9 +16,8 @@
1516
* console.error(`stderr: ${data}`);
1617
* });
1718
*
18-
* ls.on('close', (code) => {
19-
* console.log(`child process exited with code ${code}`);
20-
* });
19+
* const [code] = await once(ls, 'close');
20+
* console.log(`child process exited with code ${code}`);
2121
* ```
2222
*
2323
* By default, pipes for `stdin`, `stdout`, and `stderr` are established between
@@ -671,6 +671,7 @@ declare module "node:child_process" {
671671
*
672672
* ```js
673673
* import { spawn } from 'node:child_process';
674+
* import { once } from 'node:events';
674675
* const ls = spawn('ls', ['-lh', '/usr']);
675676
*
676677
* ls.stdout.on('data', (data) => {
@@ -681,9 +682,8 @@ declare module "node:child_process" {
681682
* console.error(`stderr: ${data}`);
682683
* });
683684
*
684-
* ls.on('close', (code) => {
685-
* console.log(`child process exited with code ${code}`);
686-
* });
685+
* const [code] = await once(ls, 'close');
686+
* console.log(`child process exited with code ${code}`);
687687
* ```
688688
*
689689
* Example: A very elaborate way to run `ps ax | grep ssh`

types/node/crypto.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2582,8 +2582,8 @@ declare module "node:crypto" {
25822582
interface X25519KeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8"> {}
25832583
interface X448KeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8"> {}
25842584
/**
2585-
* Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC,
2586-
* Ed25519, Ed448, X25519, X448, DH, and ML-DSA are currently supported.
2585+
* Generates a new asymmetric key pair of the given `type`. See the
2586+
* supported [asymmetric key types](https://nodejs.org/docs/latest-v25.x/api/crypto.html#asymmetric-key-types).
25872587
*
25882588
* If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function
25892589
* behaves as if `keyObject.export()` had been called on its result. Otherwise,
@@ -2672,8 +2672,8 @@ declare module "node:crypto" {
26722672
options?: T,
26732673
): KeyPairExportResult<T>;
26742674
/**
2675-
* Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC,
2676-
* Ed25519, Ed448, X25519, X448, and DH are currently supported.
2675+
* Generates a new asymmetric key pair of the given `type`. See the
2676+
* supported [asymmetric key types](https://nodejs.org/docs/latest-v25.x/api/crypto.html#asymmetric-key-types).
26772677
*
26782678
* If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function
26792679
* behaves as if `keyObject.export()` had been called on its result. Otherwise,

types/node/http.d.ts

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,6 +1046,7 @@ declare module "node:http" {
10461046
*
10471047
* ```js
10481048
* import http from 'node:http';
1049+
* const agent = new http.Agent({ keepAlive: true });
10491050
*
10501051
* // Server has a 5 seconds keep-alive timeout by default
10511052
* http
@@ -1679,20 +1680,34 @@ declare module "node:http" {
16791680
/**
16801681
* Produces a socket/stream to be used for HTTP requests.
16811682
*
1682-
* By default, this function is the same as `net.createConnection()`. However,
1683-
* custom agents may override this method in case greater flexibility is desired.
1683+
* By default, this function behaves identically to `net.createConnection()`,
1684+
* synchronously returning the created socket. The optional `callback` parameter in the
1685+
* signature is **not** used by this default implementation.
16841686
*
1685-
* A socket/stream can be supplied in one of two ways: by returning the
1686-
* socket/stream from this function, or by passing the socket/stream to `callback`.
1687+
* However, custom agents may override this method to provide greater flexibility,
1688+
* for example, to create sockets asynchronously. When overriding `createConnection`:
16871689
*
1688-
* This method is guaranteed to return an instance of the `net.Socket` class,
1689-
* a subclass of `stream.Duplex`, unless the user specifies a socket
1690-
* type other than `net.Socket`.
1690+
* 1. **Synchronous socket creation**: The overriding method can return the
1691+
* socket/stream directly.
1692+
* 2. **Asynchronous socket creation**: The overriding method can accept the `callback`
1693+
* and pass the created socket/stream to it (e.g., `callback(null, newSocket)`).
1694+
* If an error occurs during socket creation, it should be passed as the first
1695+
* argument to the `callback` (e.g., `callback(err)`).
16911696
*
1692-
* `callback` has a signature of `(err, stream)`.
1697+
* The agent will call the provided `createConnection` function with `options` and
1698+
* this internal `callback`. The `callback` provided by the agent has a signature
1699+
* of `(err, stream)`.
16931700
* @since v0.11.4
1694-
* @param options Options containing connection details. Check `createConnection` for the format of the options
1695-
* @param callback Callback function that receives the created socket
1701+
* @param options Options containing connection details. Check
1702+
* `net.createConnection` for the format of the options. For custom agents,
1703+
* this object is passed to the custom `createConnection` function.
1704+
* @param callback (Optional, primarily for custom agents) A function to be
1705+
* called by a custom `createConnection` implementation when the socket is
1706+
* created, especially for asynchronous operations.
1707+
* @returns The created socket. This is returned by the default
1708+
* implementation or by a custom synchronous `createConnection` implementation.
1709+
* If a custom `createConnection` uses the `callback` for asynchronous
1710+
* operation, this return value might not be the primary way to obtain the socket.
16961711
*/
16971712
createConnection(
16981713
options: ClientRequestArgs,

types/node/https.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ declare module "node:https" {
2424
}
2525
/**
2626
* An `Agent` object for HTTPS similar to `http.Agent`. See {@link request} for more information.
27+
*
28+
* Like `http.Agent`, the `createConnection(options[, callback])` method can be overridden
29+
* to customize how TLS connections are established.
30+
*
31+
* > See `agent.createConnection()` for details on overriding this method,
32+
* > including asynchronous socket creation with a callback.
2733
* @since v0.4.5
2834
*/
2935
class Agent extends http.Agent {

types/node/net.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ declare module "node:net" {
825825
function setDefaultAutoSelectFamily(value: boolean): void;
826826
/**
827827
* Gets the current default value of the `autoSelectFamilyAttemptTimeout` option of `socket.connect(options)`.
828-
* The initial default value is `250` or the value specified via the command line option `--network-family-autoselection-attempt-timeout`.
828+
* The initial default value is `500` or the value specified via the command line option `--network-family-autoselection-attempt-timeout`.
829829
* @returns The current default value of the `autoSelectFamilyAttemptTimeout` option.
830830
* @since v19.8.0, v18.8.0
831831
*/

types/node/node-tests-dom.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
import "./node-tests/events-dom";
22
import "./node-tests/globals-dom";
3-
import "./node-tests/perf_hooks-dom";

types/node/node-tests-non-dom.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
import "./node-tests/events-non-dom";
22
import "./node-tests/globals-non-dom";
3-
import "./node-tests/perf_hooks-non-dom";

types/node/node-tests-webworker.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@
22
// If this changes, and it's necessary to create a WebWorker-specific test script, then the import should be updated here.
33
import "./node-tests/events-dom";
44
import "./node-tests/globals-dom";
5-
import "./node-tests/perf_hooks-dom";

types/node/node-tests/perf_hooks-dom.ts

Lines changed: 0 additions & 2 deletions
This file was deleted.

types/node/node-tests/perf_hooks-non-dom.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)