Skip to content

Commit b358367

Browse files
authored
🤖 Merge PR DefinitelyTyped#74591 node: v25.4 by @Renegade334
1 parent 2c71f70 commit b358367

26 files changed

Lines changed: 734 additions & 549 deletions

types/node/assert.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,10 @@ declare module "node:assert" {
253253
* import assert from 'node:assert/strict';
254254
*
255255
* // Using `assert()` works the same:
256-
* assert(0);
256+
* assert(2 + 2 > 5);;
257257
* // AssertionError: The expression evaluated to a falsy value:
258258
* //
259-
* // assert(0)
259+
* // assert(2 + 2 > 5)
260260
* ```
261261
* @since v0.1.21
262262
*/

types/node/child_process.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,11 @@ declare module "node:child_process" {
228228
/**
229229
* The `subprocess.exitCode` property indicates the exit code of the child process.
230230
* If the child process is still running, the field will be `null`.
231+
*
232+
* When the child process is terminated by a signal, `subprocess.exitCode` will be
233+
* `null` and `subprocess.signalCode` will be set. To get the corresponding
234+
* POSIX exit code, use
235+
* `util.convertProcessSignalToExitCode(subprocess.signalCode)`.
231236
*/
232237
readonly exitCode: number | null;
233238
/**

types/node/events.d.ts

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -638,24 +638,17 @@ declare module "node:events" {
638638
*/
639639
function getMaxListeners(emitter: EventEmitter | EventTarget): number;
640640
/**
641-
* A class method that returns the number of listeners for the given `eventName`
642-
* registered on the given `emitter`.
641+
* Returns the number of registered listeners for the event named `eventName`.
643642
*
644-
* ```js
645-
* import { EventEmitter, listenerCount } from 'node:events';
643+
* For `EventEmitter`s this behaves exactly the same as calling `.listenerCount`
644+
* on the emitter.
646645
*
647-
* const myEmitter = new EventEmitter();
648-
* myEmitter.on('event', () => {});
649-
* myEmitter.on('event', () => {});
650-
* console.log(listenerCount(myEmitter, 'event'));
651-
* // Prints: 2
652-
* ```
646+
* For `EventTarget`s this is the only way to obtain the listener count. This can
647+
* be useful for debugging and diagnostic purposes.
653648
* @since v0.9.12
654-
* @deprecated Use `emitter.listenerCount()` instead.
655-
* @param emitter The emitter to query
656-
* @param eventName The event name
657649
*/
658650
function listenerCount(emitter: EventEmitter, eventName: string | symbol): number;
651+
function listenerCount(emitter: EventTarget, eventName: string): number;
659652
interface OnOptions extends Abortable {
660653
/**
661654
* Names of events that will end the iteration.

types/node/http.d.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2136,6 +2136,27 @@ declare module "node:http" {
21362136
* @param [max=1000]
21372137
*/
21382138
function setMaxIdleHTTPParsers(max: number): void;
2139+
/**
2140+
* Dynamically resets the global configurations to enable built-in proxy support for
2141+
* `fetch()` and `http.request()`/`https.request()` at runtime, as an alternative
2142+
* to using the `--use-env-proxy` flag or `NODE_USE_ENV_PROXY` environment variable.
2143+
* It can also be used to override settings configured from the environment variables.
2144+
*
2145+
* As this function resets the global configurations, any previously configured
2146+
* `http.globalAgent`, `https.globalAgent` or undici global dispatcher would be
2147+
* overridden after this function is invoked. It's recommended to invoke it before any
2148+
* requests are made and avoid invoking it in the middle of any requests.
2149+
*
2150+
* See [Built-in Proxy Support](https://nodejs.org/docs/latest-v25.x/api/http.html#built-in-proxy-support) for details on proxy URL formats and `NO_PROXY`
2151+
* syntax.
2152+
* @since v25.4.0
2153+
* @param proxyEnv An object containing proxy configuration. This accepts the
2154+
* same options as the `proxyEnv` option accepted by {@link Agent}. **Default:**
2155+
* `process.env`.
2156+
* @returns A function that restores the original agent and dispatcher
2157+
* settings to the state before this `http.setGlobalProxyFromEnv()` is invoked.
2158+
*/
2159+
function setGlobalProxyFromEnv(proxyEnv?: ProxyEnv): () => void;
21392160
/**
21402161
* Global instance of `Agent` which is used as the default for all HTTP client
21412162
* requests. Diverges from a default `Agent` configuration by having `keepAlive`

0 commit comments

Comments
 (0)