UEA-PRODEM

This commit is contained in:
2026-06-10 12:14:46 -03:00
parent f54126b9d8
commit 9947565694
5319 changed files with 148520 additions and 129332 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ This package contains type definitions for d3-shape (https://github.com/d3/d3-sh
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/d3-shape.
### Additional Details
* Last updated: Mon, 06 Jan 2025 00:46:49 GMT
* Last updated: Mon, 12 Jan 2026 09:42:37 GMT
* Dependencies: [@types/d3-path](https://npmjs.com/package/@types/d3-path)
# Credits
+12 -12
View File
@@ -2539,7 +2539,7 @@ export interface Stack<This, Datum, Key> {
/**
* Returns the current offset accessor, which defaults to stackOffsetNone; this uses a zero baseline.
*/
offset(): (series: Series<Datum, Key>, order: number[]) => void;
offset(): (series: Series<Datum, Key>[], order: number[]) => void;
/**
* Reset the offset to use stackOffsetNone; this uses a zero baseline.
*
@@ -2552,7 +2552,7 @@ export interface Stack<This, Datum, Key> {
* @param offset A function which is passed the generated series array and the order index array;
* it is then responsible for updating the lower and upper values in the series array.
*/
offset(offset: (series: Series<Datum, Key>, order: number[]) => void): this;
offset(offset: (series: Series<Datum, Key>[], order: number[]) => void): this;
}
/**
@@ -2641,40 +2641,40 @@ export function stackOrderReverse(series: Series<any, any>): number[];
/**
* Applies a zero baseline and normalizes the values for each point such that the topline is always one.
*
* @param series A series generated by a stack generator.
* @param series A series array generated by a stack generator.
* @param order An array of numeric indexes representing the stack order.
*/
export function stackOffsetExpand(series: Series<any, any>, order: Iterable<number>): void;
export function stackOffsetExpand(series: Series<any, any>[], order: Iterable<number>): void;
/**
* Positive values are stacked above zero, while negative values are stacked below zero.
*
* @param series A series generated by a stack generator.
* @param series A series array generated by a stack generator.
* @param order An array of numeric indexes representing the stack order.
*/
export function stackOffsetDiverging(series: Series<any, any>, order: Iterable<number>): void;
export function stackOffsetDiverging(series: Series<any, any>[], order: Iterable<number>): void;
/**
* Applies a zero baseline.
*
* @param series A series generated by a stack generator.
* @param series A series array generated by a stack generator.
* @param order An array of numeric indexes representing the stack order.
*/
export function stackOffsetNone(series: Series<any, any>, order: Iterable<number>): void;
export function stackOffsetNone(series: Series<any, any>[], order: Iterable<number>): void;
/**
* Shifts the baseline down such that the center of the streamgraph is always at zero.
*
* @param series A series generated by a stack generator.
* @param series A series array generated by a stack generator.
* @param order An array of numeric indexes representing the stack order.
*/
export function stackOffsetSilhouette(series: Series<any, any>, order: Iterable<number>): void;
export function stackOffsetSilhouette(series: Series<any, any>[], order: Iterable<number>): void;
/**
* Shifts the baseline so as to minimize the weighted wiggle of layers. This offset is recommended for streamgraphs in conjunction with the inside-out order.
* See Stacked Graphs—Geometry & Aesthetics by Bryon & Wattenberg for more information.
*
* @param series A series generated by a stack generator.
* @param series A series array generated by a stack generator.
* @param order An array of numeric indexes representing the stack order.
*/
export function stackOffsetWiggle(series: Series<any, any>, order: Iterable<number>): void;
export function stackOffsetWiggle(series: Series<any, any>[], order: Iterable<number>): void;
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@types/d3-shape",
"version": "3.1.7",
"version": "3.1.8",
"description": "TypeScript definitions for d3-shape",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/d3-shape",
"license": "MIT",
@@ -48,6 +48,6 @@
"@types/d3-path": "*"
},
"peerDependencies": {},
"typesPublisherContentHash": "799d9815b06c799db603989ab56ae5a207ba179664cd07cbc5d754a2e542d4ca",
"typeScriptVersion": "5.0"
"typesPublisherContentHash": "c63f7faa7fd70d5689095623946e70f1369c54cb6490949c7f581beabbfd61e6",
"typeScriptVersion": "5.2"
}
+1 -1
View File
@@ -8,7 +8,7 @@ This package contains type definitions for estree (https://github.com/estree/est
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree.
### Additional Details
* Last updated: Fri, 06 Jun 2025 00:04:33 GMT
* Last updated: Wed, 06 May 2026 21:01:00 GMT
* Dependencies: none
# Credits
+1 -1
View File
@@ -316,7 +316,7 @@ export interface PrivateIdentifier extends BaseNode {
export interface Property extends BaseNode {
type: "Property";
key: Expression | PrivateIdentifier;
key: Expression;
value: Expression | Pattern; // Could be an AssignmentProperty
kind: "init" | "get" | "set";
method: boolean;
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@types/estree",
"version": "1.0.8",
"version": "1.0.9",
"description": "TypeScript definitions for estree",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree",
"license": "MIT",
@@ -21,7 +21,7 @@
"scripts": {},
"dependencies": {},
"peerDependencies": {},
"typesPublisherContentHash": "7a167b6e4a4d9f6e9a2cb9fd3fc45c885f89cbdeb44b3e5961bb057a45c082fd",
"typeScriptVersion": "5.1",
"typesPublisherContentHash": "db16da859cb0bee641414117047a4becba2e9f39d3e14a6745f887c47ef68482",
"typeScriptVersion": "5.3",
"nonNpm": true
}
+1 -1
View File
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v24.
### Additional Details
* Last updated: Sun, 14 Dec 2025 00:04:32 GMT
* Last updated: Fri, 05 Jun 2026 22:33:07 GMT
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
# Credits
+6 -6
View File
@@ -5,6 +5,7 @@
*
* ```js
* import { spawn } from 'node:child_process';
* import { once } from 'node:events';
* const ls = spawn('ls', ['-lh', '/usr']);
*
* ls.stdout.on('data', (data) => {
@@ -15,9 +16,8 @@
* console.error(`stderr: ${data}`);
* });
*
* ls.on('close', (code) => {
* console.log(`child process exited with code ${code}`);
* });
* const [code] = await once(ls, 'close');
* console.log(`child process exited with code ${code}`);
* ```
*
* By default, pipes for `stdin`, `stdout`, and `stderr` are established between
@@ -719,6 +719,7 @@ declare module "child_process" {
*
* ```js
* import { spawn } from 'node:child_process';
* import { once } from 'node:events';
* const ls = spawn('ls', ['-lh', '/usr']);
*
* ls.stdout.on('data', (data) => {
@@ -729,9 +730,8 @@ declare module "child_process" {
* console.error(`stderr: ${data}`);
* });
*
* ls.on('close', (code) => {
* console.log(`child process exited with code ${code}`);
* });
* const [code] = await once(ls, 'close');
* console.log(`child process exited with code ${code}`);
* ```
*
* Example: A very elaborate way to run `ps ax | grep ssh`
+8 -8
View File
@@ -2709,12 +2709,12 @@ declare module "crypto" {
privateKey: T2;
}
/**
* Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC,
* Ed25519, Ed448, X25519, X448, DH, and ML-DSA are currently supported.
* Generates a new asymmetric key pair of the given `type`.
* See the supported [asymmetric key types](https://nodejs.org/docs/latest-v24.x/api/crypto.html#asymmetric-key-types).
*
* If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function
* behaves as if `keyObject.export()` had been called on its result. Otherwise,
* the respective part of the key is returned as a `KeyObject`.
* behaves as if {@link KeyObject.export `keyObject.export()`} had been called on its result. Otherwise,
* the respective part of the key is returned as a {@link KeyObject `KeyObject`}.
*
* When encoding public keys, it is recommended to use `'spki'`. When encoding
* private keys, it is recommended to use `'pkcs8'` with a strong passphrase,
@@ -3007,12 +3007,12 @@ declare module "crypto" {
options?: SLHDSAKeyPairKeyObjectOptions,
): KeyPairKeyObjectResult;
/**
* Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC,
* Ed25519, Ed448, X25519, X448, and DH are currently supported.
* Generates a new asymmetric key pair of the given `type`.
* See the supported [asymmetric key types](https://nodejs.org/docs/latest-v24.x/api/crypto.html#asymmetric-key-types).
*
* If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function
* behaves as if `keyObject.export()` had been called on its result. Otherwise,
* the respective part of the key is returned as a `KeyObject`.
* behaves as if {@link KeyObject.export `keyObject.export()`} had been called on its result. Otherwise,
* the respective part of the key is returned as a {@link KeyObject `KeyObject`}.
*
* It is recommended to encode public keys as `'spki'` and private keys as `'pkcs8'` with encryption for long-term storage:
*
+8 -12
View File
@@ -24,10 +24,9 @@ declare module "domain" {
*/
class Domain extends EventEmitter {
/**
* An array of timers and event emitters that have been explicitly added
* to the domain.
* An array of event emitters that have been explicitly added to the domain.
*/
members: Array<EventEmitter | NodeJS.Timer>;
members: EventEmitter[];
/**
* The `enter()` method is plumbing used by the `run()`, `bind()`, and `intercept()` methods to set the active domain. It sets `domain.active` and `process.domain` to the domain, and implicitly
* pushes the domain onto the domain
@@ -91,20 +90,17 @@ declare module "domain" {
* will be routed to the domain's `'error'` event, just like with implicit
* binding.
*
* This also works with timers that are returned from `setInterval()` and `setTimeout()`. If their callback function throws, it will be caught by
* the domain `'error'` handler.
*
* If the Timer or `EventEmitter` was already bound to a domain, it is removed
* from that one, and bound to this one instead.
* @param emitter emitter or timer to be added to the domain
* If the `EventEmitter` was already bound to a domain, it is removed from that
* one, and bound to this one instead.
* @param emitter emitter to be added to the domain
*/
add(emitter: EventEmitter | NodeJS.Timer): void;
add(emitter: EventEmitter): void;
/**
* The opposite of {@link add}. Removes domain handling from the
* specified emitter.
* @param emitter emitter or timer to be removed from the domain
* @param emitter emitter to be removed from the domain
*/
remove(emitter: EventEmitter | NodeJS.Timer): void;
remove(emitter: EventEmitter): void;
/**
* The returned function will be a wrapper around the supplied callback
* function. When the returned function is called, any errors that are
+3 -3
View File
@@ -2193,7 +2193,7 @@ declare module "fs" {
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
*/
export function mkdtempSync(prefix: string, options?: EncodingOption): string | NonSharedBuffer;
export interface DisposableTempDir extends AsyncDisposable {
export interface DisposableTempDir extends Disposable {
/**
* The path of the created directory.
*/
@@ -2201,11 +2201,11 @@ declare module "fs" {
/**
* A function which removes the created directory.
*/
remove(): Promise<void>;
remove(): void;
/**
* The same as `remove`.
*/
[Symbol.asyncDispose](): Promise<void>;
[Symbol.dispose](): void;
}
/**
* Returns a disposable object whose `path` property holds the created directory
+14 -1
View File
@@ -21,7 +21,6 @@ declare module "fs/promises" {
CopyOptions,
Dir,
Dirent,
DisposableTempDir,
EncodingOption,
GlobOptions,
GlobOptionsWithFileTypes,
@@ -981,6 +980,20 @@ declare module "fs/promises" {
prefix: string,
options?: ObjectEncodingOptions | BufferEncoding | null,
): Promise<string | NonSharedBuffer>;
interface DisposableTempDir extends AsyncDisposable {
/**
* The path of the created directory.
*/
path: string;
/**
* A function which removes the created directory.
*/
remove(): Promise<void>;
/**
* The same as `remove`.
*/
[Symbol.asyncDispose](): Promise<void>;
}
/**
* The resulting Promise holds an async-disposable object whose `path` property
* holds the created directory path. When the object is disposed, the directory
+32 -12
View File
@@ -357,6 +357,14 @@ declare module "http" {
* @since v18.17.0, v20.2.0
*/
rejectNonStandardBodyWrites?: boolean | undefined;
/**
* If set to `true`, requests without `Content-Length` or `Transfer-Encoding` headers (indicating no body)
* will be initialized with an already-ended body stream, so they will never emit any stream events
* (like `'data'` or `'end'`). You can use `req.readableEnded` to detect this case.
* @default false
* @since v24.12.0
*/
optimizeEmptyRequests?: boolean | undefined;
}
type RequestListener<
Request extends typeof IncomingMessage = typeof IncomingMessage,
@@ -939,7 +947,7 @@ declare module "http" {
* been transmitted are equal or not.
*
* Attempting to set a header field name or value that contains invalid characters
* will result in a \[`Error`\]\[\] being thrown.
* will result in a `Error` being thrown.
* @since v0.1.30
*/
writeHead(
@@ -1020,6 +1028,7 @@ declare module "http" {
*
* ```js
* import http from 'node:http';
* const agent = new http.Agent({ keepAlive: true });
*
* // Server has a 5 seconds keep-alive timeout by default
* http
@@ -1645,7 +1654,7 @@ declare module "http" {
* sockets. Do not modify.
* @since v0.5.9
*/
readonly requests: NodeJS.ReadOnlyDict<IncomingMessage[]>;
readonly requests: NodeJS.ReadOnlyDict<ClientRequest[]>;
constructor(opts?: AgentOptions);
/**
* Destroy any sockets that are currently in use by the agent.
@@ -1661,20 +1670,31 @@ declare module "http" {
/**
* Produces a socket/stream to be used for HTTP requests.
*
* By default, this function is the same as `net.createConnection()`. However,
* custom agents may override this method in case greater flexibility is desired.
* By default, this function behaves identically to `net.createConnection()`, synchronously
* returning the created socket. The optional `callback` parameter in the signature is not
* used by this default implementation.
*
* A socket/stream can be supplied in one of two ways: by returning the
* socket/stream from this function, or by passing the socket/stream to `callback`.
* However, custom agents may override this method to provide greater flexibility,
* for example, to create sockets asynchronously. When overriding `createConnection`:
*
* This method is guaranteed to return an instance of the `net.Socket` class,
* a subclass of `stream.Duplex`, unless the user specifies a socket
* type other than `net.Socket`.
* 1. **Synchronous socket creation**: The overriding method can return the socket/stream directly.
* 2. **Asynchronous socket creation**: The overriding method can accept the `callback` and pass
* the created socket/stream to it (e.g., `callback(null, newSocket)`). If an error occurs during
* socket creation, it should be passed as the first argument to the `callback` (e.g., `callback(err)`).
*
* `callback` has a signature of `(err, stream)`.
* The agent will call the provided `createConnection` function with `options` and this internal
* `callback`. The `callback` provided by the agent has a signature of `(err, stream)`.
* @since v0.11.4
* @param options Options containing connection details. Check `createConnection` for the format of the options
* @param callback Callback function that receives the created socket
* @param options Options containing connection details. Check `net.createConnection()`
* for the format of the options. For custom agents, this object is passed
* to the custom `createConnection` function.
* @param callback (Optional, primarily for custom agents) A function to be called by a custom
* `createConnection` implementation when the socket is created, especially for
* asynchronous operations.
* @returns `stream.Duplex` The created socket. This is returned by the default implementation
* or by a custom synchronous `createConnection` implementation. If a
* custom `createConnection` uses the `callback` for asynchronous operation,
* this return value might not be the primary way to obtain the socket.
*/
createConnection(
options: ClientRequestArgs,
+102 -24
View File
@@ -197,7 +197,10 @@ declare module "http2" {
addListener(event: "end", listener: () => void): this;
addListener(event: "error", listener: (err: Error) => void): this;
addListener(event: "finish", listener: () => void): this;
addListener(event: "frameError", listener: (frameType: number, errorCode: number) => void): this;
addListener(
event: "frameError",
listener: (frameType: number, errorCode: number, id: number) => void,
): this;
addListener(event: "pipe", listener: (src: stream.Readable) => void): this;
addListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
addListener(event: "streamClosed", listener: (code: number) => void): this;
@@ -212,7 +215,7 @@ declare module "http2" {
emit(event: "end"): boolean;
emit(event: "error", err: Error): boolean;
emit(event: "finish"): boolean;
emit(event: "frameError", frameType: number, errorCode: number): boolean;
emit(event: "frameError", frameType: number, errorCode: number, id: number): boolean;
emit(event: "pipe", src: stream.Readable): boolean;
emit(event: "unpipe", src: stream.Readable): boolean;
emit(event: "streamClosed", code: number): boolean;
@@ -227,7 +230,7 @@ declare module "http2" {
on(event: "end", listener: () => void): this;
on(event: "error", listener: (err: Error) => void): this;
on(event: "finish", listener: () => void): this;
on(event: "frameError", listener: (frameType: number, errorCode: number) => void): this;
on(event: "frameError", listener: (frameType: number, errorCode: number, id: number) => void): this;
on(event: "pipe", listener: (src: stream.Readable) => void): this;
on(event: "unpipe", listener: (src: stream.Readable) => void): this;
on(event: "streamClosed", listener: (code: number) => void): this;
@@ -242,7 +245,7 @@ declare module "http2" {
once(event: "end", listener: () => void): this;
once(event: "error", listener: (err: Error) => void): this;
once(event: "finish", listener: () => void): this;
once(event: "frameError", listener: (frameType: number, errorCode: number) => void): this;
once(event: "frameError", listener: (frameType: number, errorCode: number, id: number) => void): this;
once(event: "pipe", listener: (src: stream.Readable) => void): this;
once(event: "unpipe", listener: (src: stream.Readable) => void): this;
once(event: "streamClosed", listener: (code: number) => void): this;
@@ -257,7 +260,10 @@ declare module "http2" {
prependListener(event: "end", listener: () => void): this;
prependListener(event: "error", listener: (err: Error) => void): this;
prependListener(event: "finish", listener: () => void): this;
prependListener(event: "frameError", listener: (frameType: number, errorCode: number) => void): this;
prependListener(
event: "frameError",
listener: (frameType: number, errorCode: number, id: number) => void,
): this;
prependListener(event: "pipe", listener: (src: stream.Readable) => void): this;
prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
prependListener(event: "streamClosed", listener: (code: number) => void): this;
@@ -272,7 +278,10 @@ declare module "http2" {
prependOnceListener(event: "end", listener: () => void): this;
prependOnceListener(event: "error", listener: (err: Error) => void): this;
prependOnceListener(event: "finish", listener: () => void): this;
prependOnceListener(event: "frameError", listener: (frameType: number, errorCode: number) => void): this;
prependOnceListener(
event: "frameError",
listener: (frameType: number, errorCode: number, id: number) => void,
): this;
prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this;
prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
prependOnceListener(event: "streamClosed", listener: (code: number) => void): this;
@@ -671,6 +680,7 @@ declare module "http2" {
maxConcurrentStreams?: number | undefined;
maxHeaderListSize?: number | undefined;
enableConnectProtocol?: boolean | undefined;
customSettings?: { [key: number]: number };
}
export interface ClientSessionRequestOptions {
endStream?: boolean | undefined;
@@ -896,7 +906,7 @@ declare module "http2" {
addListener(event: "error", listener: (err: Error) => void): this;
addListener(
event: "frameError",
listener: (frameType: number, errorCode: number, streamID: number) => void,
listener: (frameType: number, errorCode: number, id: number) => void,
): this;
addListener(
event: "goaway",
@@ -909,7 +919,7 @@ declare module "http2" {
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
emit(event: "close"): boolean;
emit(event: "error", err: Error): boolean;
emit(event: "frameError", frameType: number, errorCode: number, streamID: number): boolean;
emit(event: "frameError", frameType: number, errorCode: number, id: number): boolean;
emit(event: "goaway", errorCode: number, lastStreamID: number, opaqueData?: NonSharedBuffer): boolean;
emit(event: "localSettings", settings: Settings): boolean;
emit(event: "ping"): boolean;
@@ -918,7 +928,7 @@ declare module "http2" {
emit(event: string | symbol, ...args: any[]): boolean;
on(event: "close", listener: () => void): this;
on(event: "error", listener: (err: Error) => void): this;
on(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this;
on(event: "frameError", listener: (frameType: number, errorCode: number, id: number) => void): this;
on(
event: "goaway",
listener: (errorCode: number, lastStreamID: number, opaqueData?: NonSharedBuffer) => void,
@@ -930,7 +940,7 @@ declare module "http2" {
on(event: string | symbol, listener: (...args: any[]) => void): this;
once(event: "close", listener: () => void): this;
once(event: "error", listener: (err: Error) => void): this;
once(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this;
once(event: "frameError", listener: (frameType: number, errorCode: number, id: number) => void): this;
once(
event: "goaway",
listener: (errorCode: number, lastStreamID: number, opaqueData?: NonSharedBuffer) => void,
@@ -944,7 +954,7 @@ declare module "http2" {
prependListener(event: "error", listener: (err: Error) => void): this;
prependListener(
event: "frameError",
listener: (frameType: number, errorCode: number, streamID: number) => void,
listener: (frameType: number, errorCode: number, id: number) => void,
): this;
prependListener(
event: "goaway",
@@ -959,7 +969,7 @@ declare module "http2" {
prependOnceListener(event: "error", listener: (err: Error) => void): this;
prependOnceListener(
event: "frameError",
listener: (frameType: number, errorCode: number, streamID: number) => void,
listener: (frameType: number, errorCode: number, id: number) => void,
): this;
prependOnceListener(
event: "goaway",
@@ -1420,6 +1430,8 @@ declare module "http2" {
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
> extends SessionOptions {
maxSessionRejectedStreams?: number | undefined;
maxSessionInvalidFrames?: number | undefined;
streamResetBurst?: number | undefined;
streamResetRate?: number | undefined;
Http1IncomingMessage?: Http1Request | undefined;
@@ -1475,7 +1487,13 @@ declare module "http2" {
event: "session",
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
): this;
addListener(event: "sessionError", listener: (err: Error) => void): this;
addListener(
event: "sessionError",
listener: (
err: Error,
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
) => void,
): this;
addListener(
event: "stream",
listener: (
@@ -1497,7 +1515,11 @@ declare module "http2" {
event: "session",
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
): boolean;
emit(event: "sessionError", err: Error): boolean;
emit(
event: "sessionError",
err: Error,
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
): boolean;
emit(
event: "stream",
stream: ServerHttp2Stream,
@@ -1519,7 +1541,13 @@ declare module "http2" {
event: "session",
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
): this;
on(event: "sessionError", listener: (err: Error) => void): this;
on(
event: "sessionError",
listener: (
err: Error,
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
) => void,
): this;
on(
event: "stream",
listener: (
@@ -1543,7 +1571,13 @@ declare module "http2" {
event: "session",
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
): this;
once(event: "sessionError", listener: (err: Error) => void): this;
once(
event: "sessionError",
listener: (
err: Error,
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
) => void,
): this;
once(
event: "stream",
listener: (
@@ -1567,7 +1601,13 @@ declare module "http2" {
event: "session",
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
): this;
prependListener(event: "sessionError", listener: (err: Error) => void): this;
prependListener(
event: "sessionError",
listener: (
err: Error,
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
) => void,
): this;
prependListener(
event: "stream",
listener: (
@@ -1591,7 +1631,13 @@ declare module "http2" {
event: "session",
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
): this;
prependOnceListener(event: "sessionError", listener: (err: Error) => void): this;
prependOnceListener(
event: "sessionError",
listener: (
err: Error,
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
) => void,
): this;
prependOnceListener(
event: "stream",
listener: (
@@ -1622,7 +1668,11 @@ declare module "http2" {
event: "session",
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
): this;
addListener(event: "sessionError", listener: (err: Error) => void): this;
addListener(
event: "sessionError",
listener: (err: Error) => void,
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
): this;
addListener(
event: "stream",
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
@@ -1640,7 +1690,11 @@ declare module "http2" {
event: "session",
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
): boolean;
emit(event: "sessionError", err: Error): boolean;
emit(
event: "sessionError",
err: Error,
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
): boolean;
emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
emit(event: "timeout"): boolean;
emit(event: "unknownProtocol", socket: tls.TLSSocket): boolean;
@@ -1657,7 +1711,13 @@ declare module "http2" {
event: "session",
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
): this;
on(event: "sessionError", listener: (err: Error) => void): this;
on(
event: "sessionError",
listener: (
err: Error,
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
) => void,
): this;
on(
event: "stream",
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
@@ -1677,7 +1737,13 @@ declare module "http2" {
event: "session",
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
): this;
once(event: "sessionError", listener: (err: Error) => void): this;
once(
event: "sessionError",
listener: (
err: Error,
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
) => void,
): this;
once(
event: "stream",
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
@@ -1697,7 +1763,13 @@ declare module "http2" {
event: "session",
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
): this;
prependListener(event: "sessionError", listener: (err: Error) => void): this;
prependListener(
event: "sessionError",
listener: (
err: Error,
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
) => void,
): this;
prependListener(
event: "stream",
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
@@ -1717,7 +1789,13 @@ declare module "http2" {
event: "session",
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
): this;
prependOnceListener(event: "sessionError", listener: (err: Error) => void): this;
prependOnceListener(
event: "sessionError",
listener: (
err: Error,
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
) => void,
): this;
prependOnceListener(
event: "stream",
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
+6
View File
@@ -25,6 +25,12 @@ declare module "https" {
}
/**
* An `Agent` object for HTTPS similar to `http.Agent`. See {@link request} for more information.
*
* Like `http.Agent`, the `createConnection(options[, callback])` method can be overridden to customize
* how TLS connections are established.
*
* > See [`agent.createConnection()`](https://nodejs.org/docs/latest-v24.x/api/http.html#agentcreateconnectionoptions-callback)
* for details on overriding this method, including asynchronous socket creation with a callback.
* @since v0.4.5
*/
class Agent extends http.Agent {
+414 -408
View File
File diff suppressed because it is too large Load Diff
+27 -78
View File
@@ -80,37 +80,48 @@ declare module "module" {
*/
directory?: string;
}
interface EnableCompileCacheOptions {
/**
* Optional. Directory to store the compile cache. If not specified, the directory specified by
* the [`NODE_COMPILE_CACHE=dir`](https://nodejs.org/docs/latest-v24.x/api/cli.html#node_compile_cachedir)
* environment variable will be used if it's set, or `path.join(os.tmpdir(), 'node-compile-cache')` otherwise.
* @since v24.12.0
*/
directory?: string | undefined;
/**
* Optional. If `true`, enables portable compile cache so that the cache can be reused even if the project directory
* is moved. This is a best-effort feature. If not specified, it will depend on whether the environment variable
* [NODE_COMPILE_CACHE_PORTABLE=1](https://nodejs.org/docs/latest-v24.x/api/cli.html#node_compile_cache_portable1) is set.
* @since v24.12.0
*/
portable?: boolean | undefined;
}
/**
* Enable [module compile cache](https://nodejs.org/docs/latest-v24.x/api/module.html#module-compile-cache)
* in the current Node.js instance.
*
* If `cacheDir` is not specified, Node.js will either use the directory specified by the
* `NODE_COMPILE_CACHE=dir` environment variable if it's set, or use
* `path.join(os.tmpdir(), 'node-compile-cache')` otherwise. For general use cases, it's
* recommended to call `module.enableCompileCache()` without specifying the `cacheDir`,
* so that the directory can be overridden by the `NODE_COMPILE_CACHE` environment
* For general use cases, it's recommended to call `module.enableCompileCache()` without specifying the
* `options.directory`, so that the directory can be overridden by the `NODE_COMPILE_CACHE` environment
* variable when necessary.
*
* Since compile cache is supposed to be a quiet optimization that is not required for the
* application to be functional, this method is designed to not throw any exception when the
* compile cache cannot be enabled. Instead, it will return an object containing an error
* message in the `message` field to aid debugging.
* If compile cache is enabled successfully, the `directory` field in the returned object
* contains the path to the directory where the compile cache is stored. The `status`
* field in the returned object would be one of the `module.constants.compileCacheStatus`
* values to indicate the result of the attempt to enable the
* Since compile cache is supposed to be a optimization that is not mission critical, this method is
* designed to not throw any exception when the compile cache cannot be enabled. Instead, it will return
* an object containing an error message in the `message` field to aid debugging. If compile cache is
* enabled successfully, the `directory` field in the returned object contains the path to the directory
* where the compile cache is stored. The `status` field in the returned object would be one of the
* `module.constants.compileCacheStatus` values to indicate the result of the attempt to enable the
* [module compile cache](https://nodejs.org/docs/latest-v24.x/api/module.html#module-compile-cache).
*
* This method only affects the current Node.js instance. To enable it in child worker threads,
* either call this method in child worker threads too, or set the
* `process.env.NODE_COMPILE_CACHE` value to compile cache directory so the behavior can
* be inherited into the child workers. The directory can be obtained either from the
* `directory` field returned by this method, or with {@link getCompileCacheDir}.
* `directory` field returned by this method, or with {@link getCompileCacheDir `module.getCompileCacheDir()`}.
* @since v22.8.0
* @param cacheDir Optional path to specify the directory where the compile cache
* @param options Optional. If a string is passed, it is considered to be `options.directory`.
* will be stored/retrieved.
*/
function enableCompileCache(cacheDir?: string): EnableCompileCacheResult;
function enableCompileCache(options?: string | EnableCompileCacheOptions): EnableCompileCacheResult;
/**
* Flush the [module compile cache](https://nodejs.org/docs/latest-v24.x/api/module.html#module-compile-cache)
* accumulated from modules already loaded
@@ -370,59 +381,18 @@ declare module "module" {
| "module-typescript"
| "wasm";
type ModuleSource = string | ArrayBuffer | NodeJS.TypedArray;
/**
* The `initialize` hook provides a way to define a custom function that runs in
* the hooks thread when the hooks module is initialized. Initialization happens
* when the hooks module is registered via {@link register}.
*
* This hook can receive data from a {@link register} invocation, including
* ports and other transferable objects. The return value of `initialize` can be a
* `Promise`, in which case it will be awaited before the main application thread
* execution resumes.
*/
type InitializeHook<Data = any> = (data: Data) => void | Promise<void>;
interface ResolveHookContext {
/**
* Export conditions of the relevant `package.json`
*/
conditions: string[];
/**
* An object whose key-value pairs represent the assertions for the module to import
*/
importAttributes: ImportAttributes;
/**
* The module importing this one, or undefined if this is the Node.js entry point
*/
parentURL: string | undefined;
}
interface ResolveFnOutput {
/**
* A hint to the load hook (it might be ignored); can be an intermediary value.
*/
format?: string | null | undefined;
/**
* The import attributes to use when caching the module (optional; if excluded the input will be used)
*/
importAttributes?: ImportAttributes | undefined;
/**
* A signal that this hook intends to terminate the chain of `resolve` hooks.
* @default false
*/
shortCircuit?: boolean | undefined;
/**
* The absolute URL to which this input resolves
*/
url: string;
}
/**
* The `resolve` hook chain is responsible for telling Node.js where to find and
* how to cache a given `import` statement or expression, or `require` call. It can
* optionally return a format (such as `'module'`) as a hint to the `load` hook. If
* a format is specified, the `load` hook is ultimately responsible for providing
* the final `format` value (and it is free to ignore the hint provided by
* `resolve`); if `resolve` provides a `format`, a custom `load` hook is required
* even if only to pass the value to the Node.js default `load` hook.
*/
type ResolveHook = (
specifier: string,
context: ResolveHookContext,
@@ -440,36 +410,15 @@ declare module "module" {
) => ResolveFnOutput,
) => ResolveFnOutput;
interface LoadHookContext {
/**
* Export conditions of the relevant `package.json`
*/
conditions: string[];
/**
* The format optionally supplied by the `resolve` hook chain (can be an intermediary value).
*/
format: string | null | undefined;
/**
* An object whose key-value pairs represent the assertions for the module to import
*/
importAttributes: ImportAttributes;
}
interface LoadFnOutput {
format: string | null | undefined;
/**
* A signal that this hook intends to terminate the chain of `resolve` hooks.
* @default false
*/
shortCircuit?: boolean | undefined;
/**
* The source for Node.js to evaluate
*/
source?: ModuleSource | undefined;
}
/**
* The `load` hook provides a way to define a custom method of determining how a
* URL should be interpreted, retrieved, and parsed. It is also in charge of
* validating the import attributes.
*/
type LoadHook = (
url: string,
context: LoadHookContext,
+25 -6
View File
@@ -34,6 +34,10 @@ declare module "net" {
readable?: boolean | undefined;
writable?: boolean | undefined;
signal?: AbortSignal | undefined;
noDelay?: boolean | undefined;
keepAlive?: boolean | undefined;
keepAliveInitialDelay?: number | undefined;
blockList?: BlockList | undefined;
}
interface OnReadOpts {
buffer: Uint8Array | (() => Uint8Array);
@@ -52,9 +56,6 @@ declare module "net" {
hints?: number | undefined;
family?: number | undefined;
lookup?: LookupFunction | undefined;
noDelay?: boolean | undefined;
keepAlive?: boolean | undefined;
keepAliveInitialDelay?: number | undefined;
/**
* @since v18.13.0
*/
@@ -63,7 +64,6 @@ declare module "net" {
* @since v18.13.0
*/
autoSelectFamilyAttemptTimeout?: number | undefined;
blockList?: BlockList | undefined;
}
interface IpcSocketConnectOpts {
path: string;
@@ -105,9 +105,14 @@ declare module "net" {
* See `Writable` stream `write()` method for more
* information.
* @since v0.1.90
* @param [encoding='utf8'] Only used when data is `string`.
*/
write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
/**
* Sends data on the socket, with an explicit encoding for string data.
* @see {@link Socket.write} for full details.
* @since v0.1.90
* @param [encoding='utf8'] Only used when data is `string`.
*/
write(str: Uint8Array | string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
/**
* Initiate a connection on a given socket.
@@ -347,12 +352,26 @@ declare module "net" {
*
* See `writable.end()` for further details.
* @since v0.1.90
* @param [encoding='utf8'] Only used when data is `string`.
* @param callback Optional callback for when the socket is finished.
* @return The socket itself.
*/
end(callback?: () => void): this;
/**
* Half-closes the socket, with one final chunk of data.
* @see {@link Socket.end} for full details.
* @since v0.1.90
* @param callback Optional callback for when the socket is finished.
* @return The socket itself.
*/
end(buffer: Uint8Array | string, callback?: () => void): this;
/**
* Half-closes the socket, with one final chunk of data.
* @see {@link Socket.end} for full details.
* @since v0.1.90
* @param [encoding='utf8'] Only used when data is `string`.
* @param callback Optional callback for when the socket is finished.
* @return The socket itself.
*/
end(str: Uint8Array | string, encoding?: BufferEncoding, callback?: () => void): this;
/**
* events.EventEmitter
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@types/node",
"version": "24.10.4",
"version": "24.13.1",
"description": "TypeScript definitions for node",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
"license": "MIT",
@@ -147,9 +147,9 @@
},
"scripts": {},
"dependencies": {
"undici-types": "~7.16.0"
"undici-types": "~7.18.0"
},
"peerDependencies": {},
"typesPublisherContentHash": "3a9013632111e49759d702b082ccfa1cce713feb78de09513919546221062945",
"typeScriptVersion": "5.2"
"typesPublisherContentHash": "fa312cd3b08062d3d95a56c5ce645db8cdd1bf6221ced016b849492c72d3286c",
"typeScriptVersion": "5.3"
}
+125 -65
View File
@@ -200,14 +200,6 @@ declare module "perf_hooks" {
active: number;
utilization: number;
}
/**
* @param utilization1 The result of a previous call to `eventLoopUtilization()`.
* @param utilization2 The result of a previous call to `eventLoopUtilization()` prior to `utilization1`.
*/
type EventLoopUtilityFunction = (
utilization1?: EventLoopUtilization,
utilization2?: EventLoopUtilization,
) => EventLoopUtilization;
interface MarkOptions {
/**
* Additional optional detail to include with the mark.
@@ -264,11 +256,19 @@ declare module "perf_hooks" {
*/
clearResourceTimings(name?: string): void;
/**
* eventLoopUtilization is similar to CPU utilization except that it is calculated using high precision wall-clock time.
* It represents the percentage of time the event loop has spent outside the event loop's event provider (e.g. epoll_wait).
* No other CPU idle time is taken into consideration.
* This is an alias of `perf_hooks.eventLoopUtilization()`.
*
* _This property is an extension by Node.js. It is not available in Web browsers._
* @since v14.10.0, v12.19.0
* @param utilization1 The result of a previous call to
* `eventLoopUtilization()`.
* @param utilization2 The result of a previous call to
* `eventLoopUtilization()` prior to `utilization1`.
*/
eventLoopUtilization: EventLoopUtilityFunction;
eventLoopUtilization(
utilization1?: EventLoopUtilization,
utilization2?: EventLoopUtilization,
): EventLoopUtilization;
/**
* Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`.
* If you are only interested in performance entries of certain types or that have certain names, see
@@ -371,41 +371,12 @@ declare module "perf_hooks" {
*/
readonly timeOrigin: number;
/**
* This is an alias of `perf_hooks.timerify()`.
*
* _This property is an extension by Node.js. It is not available in Web browsers._
*
* Wraps a function within a new function that measures the running time of the wrapped function.
* A `PerformanceObserver` must be subscribed to the `'function'` event type in order for the timing details to be accessed.
*
* ```js
* import {
* performance,
* PerformanceObserver,
* } from 'node:perf_hooks';
*
* function someFunction() {
* console.log('hello world');
* }
*
* const wrapped = performance.timerify(someFunction);
*
* const obs = new PerformanceObserver((list) => {
* console.log(list.getEntries()[0].duration);
*
* performance.clearMarks();
* performance.clearMeasures();
* obs.disconnect();
* });
* obs.observe({ entryTypes: ['function'] });
*
* // A performance timeline entry will be created
* wrapped();
* ```
*
* If the wrapped function returns a promise, a finally handler will be attached to the promise and the duration will be reported
* once the finally handler is invoked.
* @param fn
* @since v8.5.0
*/
timerify<T extends (...params: any[]) => any>(fn: T, options?: TimerifyOptions): T;
timerify<T extends (...args: any[]) => any>(fn: T, options?: TimerifyOptions): T;
/**
* An object which is JSON representation of the performance object. It is similar to
* [`window.performance.toJSON`](https://developer.mozilla.org/en-US/docs/Web/API/Performance/toJSON) in browsers.
@@ -844,6 +815,83 @@ declare module "perf_hooks" {
*/
add(other: RecordableHistogram): void;
}
interface CreateHistogramOptions {
/**
* The lowest discernible value. Must be an integer value greater than 0.
* @default 1
*/
lowest?: number | bigint | undefined;
/**
* The highest recordable value. Must be an integer value that is equal to
* or greater than two times `lowest`.
* @default Number.MAX_SAFE_INTEGER
*/
highest?: number | bigint | undefined;
/**
* The number of accuracy digits. Must be a number between `1` and `5`.
* @default 3
*/
figures?: number | undefined;
}
/**
* Returns a {@link RecordableHistogram `RecordableHistogram`}.
* @since v15.9.0, v14.18.0
*/
function createHistogram(options?: CreateHistogramOptions): RecordableHistogram;
/**
* The `eventLoopUtilization()` function returns an object that contains the
* cumulative duration of time the event loop has been both idle and active as a
* high resolution milliseconds timer. The `utilization` value is the calculated
* Event Loop Utilization (ELU).
*
* If bootstrapping has not yet finished on the main thread the properties have
* the value of `0`. The ELU is immediately available on
* [Worker threads](https://nodejs.org/docs/latest-v24.x/api/worker_threads.html#worker-threads)
* since bootstrap happens within the event loop.
*
* Both `utilization1` and `utilization2` are optional parameters.
*
* If `utilization1` is passed, then the delta between the current call's `active`
* and `idle` times, as well as the corresponding `utilization` value are
* calculated and returned (similar to `process.hrtime()`).
*
* If `utilization1` and `utilization2` are both passed, then the delta is
* calculated between the two arguments. This is a convenience option because,
* unlike `process.hrtime()`, calculating the ELU is more complex than a
* single subtraction.
*
* ELU is similar to CPU utilization, except that it only measures event loop
* statistics and not CPU usage. It represents the percentage of time the event
* loop has spent outside the event loop's event provider (e.g. `epoll_wait`).
* No other CPU idle time is taken into consideration. The following is an example
* of how a mostly idle process will have a high ELU.
*
* ```js
* import { eventLoopUtilization } from 'node:perf_hooks';
* import { spawnSync } from 'node:child_process';
*
* setImmediate(() => {
* const elu = eventLoopUtilization();
* spawnSync('sleep', ['5']);
* console.log(eventLoopUtilization(elu).utilization);
* });
* ```
*
* Although the CPU is mostly idle while running this script, the value of `utilization`
* is `1`. This is because the call to `child_process.spawnSync()` blocks the event loop
* from proceeding.
*
* Passing in a user-defined object instead of the result of a previous call to
* `eventLoopUtilization()` will lead to undefined behavior. The return values are not
* guaranteed to reflect any correct state of the event loop.
* @since v24.12.0
* @param utilization1 The result of a previous call to `eventLoopUtilization()`.
* @param utilization2 The result of a previous call to `eventLoopUtilization()` prior to `utilization1`.
*/
function eventLoopUtilization(
utilization1?: EventLoopUtilization,
utilization2?: EventLoopUtilization,
): EventLoopUtilization;
/**
* _This property is an extension by Node.js. It is not available in Web browsers._
*
@@ -873,28 +921,40 @@ declare module "perf_hooks" {
* @since v11.10.0
*/
function monitorEventLoopDelay(options?: EventLoopMonitorOptions): IntervalHistogram;
interface CreateHistogramOptions {
/**
* The minimum recordable value. Must be an integer value greater than 0.
* @default 1
*/
lowest?: number | bigint | undefined;
/**
* The maximum recordable value. Must be an integer value greater than min.
* @default Number.MAX_SAFE_INTEGER
*/
highest?: number | bigint | undefined;
/**
* The number of accuracy digits. Must be a number between 1 and 5.
* @default 3
*/
figures?: number | undefined;
}
/**
* Returns a `RecordableHistogram`.
* @since v15.9.0, v14.18.0
* _This property is an extension by Node.js. It is not available in Web browsers._
*
* Wraps a function within a new function that measures the running time of the
* wrapped function. A `PerformanceObserver` must be subscribed to the `'function'`
* event type in order for the timing details to be accessed.
*
* ```js
* import { timerify, performance, PerformanceObserver } from 'node:perf_hooks';
*
* function someFunction() {
* console.log('hello world');
* }
*
* const wrapped = timerify(someFunction);
*
* const obs = new PerformanceObserver((list) => {
* console.log(list.getEntries()[0].duration);
*
* performance.clearMarks();
* performance.clearMeasures();
* obs.disconnect();
* });
* obs.observe({ entryTypes: ['function'] });
*
* // A performance timeline entry will be created
* wrapped();
* ```
*
* If the wrapped function returns a promise, a finally handler will be attached
* to the promise and the duration will be reported once the finally handler is invoked.
* @since v24.12.0
*/
function createHistogram(options?: CreateHistogramOptions): RecordableHistogram;
function timerify<T extends (...params: any[]) => any>(fn: T, options?: TimerifyOptions): T;
import {
performance as _performance,
PerformanceEntry as _PerformanceEntry,
+36 -8
View File
@@ -235,7 +235,7 @@ declare module "process" {
/**
* A value that is `"strip"` by default,
* `"transform"` if Node.js is run with `--experimental-transform-types`, and `false` if
* Node.js is run with `--no-experimental-strip-types`.
* Node.js is run with `--no-strip-types`.
* @since v22.10.0
*/
readonly typescript: "strip" | "transform" | false;
@@ -344,12 +344,7 @@ declare module "process" {
isTTY?: true | undefined;
}
// Alias for compatibility
interface ProcessEnv extends Dict<string> {
/**
* Can be used to change the default timezone at runtime
*/
TZ?: string | undefined;
}
interface ProcessEnv extends Dict<string> {}
interface HRTime {
/**
* This is the legacy version of {@link process.hrtime.bigint()}
@@ -472,6 +467,11 @@ declare module "process" {
* @default false
*/
reportOnUncaughtException: boolean;
/**
* If true, a diagnostic report is generated without the environment variables.
* @default false
*/
excludeEnv: boolean;
/**
* The signal used to trigger the creation of a diagnostic report.
* @default 'SIGUSR2'
@@ -608,7 +608,8 @@ declare module "process" {
* arguments passed when the Node.js process was launched. The first element will
* be {@link execPath}. See `process.argv0` if access to the original value
* of `argv[0]` is needed. The second element will be the path to the JavaScript
* file being executed. The remaining elements will be any additional command-line
* file being executed. If a [program entry point](https://nodejs.org/docs/latest-v24.x/api/cli.html#program-entry-point) was provided, the second element
* will be the absolute path to it. The remaining elements are additional command-line
* arguments.
*
* For example, assuming the following script for `process-args.js`:
@@ -1740,6 +1741,24 @@ declare module "process" {
*/
readonly release: ProcessRelease;
readonly features: ProcessFeatures;
/**
* The `process.traceProcessWarnings` property indicates whether the `--trace-warnings` flag
* is set on the current Node.js process. This property allows programmatic control over the
* tracing of warnings, enabling or disabling stack traces for warnings at runtime.
*
* ```js
* // Enable trace warnings
* process.traceProcessWarnings = true;
*
* // Emit a warning with a stack trace
* process.emitWarning('Warning with stack trace');
*
* // Disable trace warnings
* process.traceProcessWarnings = false;
* ```
* @since v6.10.0
*/
traceProcessWarnings: boolean;
/**
* `process.umask()` returns the Node.js process's file mode creation mask. Child
* processes inherit the mask from the parent process.
@@ -1785,6 +1804,15 @@ declare module "process" {
options?: MessageOptions,
callback?: (error: Error | null) => void,
): boolean;
send?(
message: any,
sendHandle: SendHandle,
callback?: (error: Error | null) => void,
): boolean;
send?(
message: any,
callback: (error: Error | null) => void,
): boolean;
/**
* If the Node.js process is spawned with an IPC channel (see the `Child Process` and `Cluster` documentation), the `process.disconnect()` method will close the
* IPC channel to the parent process, allowing the child process to exit gracefully
+6
View File
@@ -257,6 +257,7 @@ declare module "readline" {
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "close", listener: () => void): this;
addListener(event: "error", listener: (error: Error) => void): this;
addListener(event: "line", listener: (input: string) => void): this;
addListener(event: "pause", listener: () => void): this;
addListener(event: "resume", listener: () => void): this;
@@ -266,6 +267,7 @@ declare module "readline" {
addListener(event: "history", listener: (history: string[]) => void): this;
emit(event: string | symbol, ...args: any[]): boolean;
emit(event: "close"): boolean;
emit(event: "error", error: Error): boolean;
emit(event: "line", input: string): boolean;
emit(event: "pause"): boolean;
emit(event: "resume"): boolean;
@@ -275,6 +277,7 @@ declare module "readline" {
emit(event: "history", history: string[]): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: "close", listener: () => void): this;
on(event: "error", listener: (error: Error) => void): this;
on(event: "line", listener: (input: string) => void): this;
on(event: "pause", listener: () => void): this;
on(event: "resume", listener: () => void): this;
@@ -284,6 +287,7 @@ declare module "readline" {
on(event: "history", listener: (history: string[]) => void): this;
once(event: string, listener: (...args: any[]) => void): this;
once(event: "close", listener: () => void): this;
once(event: "error", listener: (error: Error) => void): this;
once(event: "line", listener: (input: string) => void): this;
once(event: "pause", listener: () => void): this;
once(event: "resume", listener: () => void): this;
@@ -293,6 +297,7 @@ declare module "readline" {
once(event: "history", listener: (history: string[]) => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: "close", listener: () => void): this;
prependListener(event: "error", listener: (error: Error) => void): this;
prependListener(event: "line", listener: (input: string) => void): this;
prependListener(event: "pause", listener: () => void): this;
prependListener(event: "resume", listener: () => void): this;
@@ -302,6 +307,7 @@ declare module "readline" {
prependListener(event: "history", listener: (history: string[]) => void): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: "close", listener: () => void): this;
prependOnceListener(event: "error", listener: (error: Error) => void): this;
prependOnceListener(event: "line", listener: (input: string) => void): this;
prependOnceListener(event: "pause", listener: () => void): this;
prependOnceListener(event: "resume", listener: () => void): this;
+126 -23
View File
@@ -6,12 +6,7 @@
* import sqlite from 'node:sqlite';
* ```
*
* This module is only available under the `node:` scheme. The following will not
* work:
*
* ```js
* import sqlite from 'sqlite';
* ```
* This module is only available under the `node:` scheme.
*
* The following example shows the basic usage of the `node:sqlite` module to open
* an in-memory database, write data to the database, and then read the data back.
@@ -123,6 +118,14 @@ declare module "node:sqlite" {
* @default false
*/
allowUnknownNamedParameters?: boolean | undefined;
/**
* If `true`, enables the defensive flag. When the defensive flag is enabled,
* language features that allow ordinary SQL to deliberately corrupt the database
* file are disabled. The defensive flag can also be set using `enableDefensive()`.
* @since v24.12.0
* @default true
*/
defensive?: boolean | undefined;
}
interface CreateSessionOptions {
/**
@@ -294,6 +297,16 @@ declare module "node:sqlite" {
* @param allow Whether to allow loading extensions.
*/
enableLoadExtension(allow: boolean): void;
/**
* Enables or disables the defensive flag. When the defensive flag is active,
* language features that allow ordinary SQL to deliberately corrupt the
* database file are disabled.
* See [`SQLITE_DBCONFIG_DEFENSIVE`](https://www.sqlite.org/c3ref/c_dbconfig_defensive.html#sqlitedbconfigdefensive)
* in the SQLite documentation for details.
* @since v24.12.0
* @param active Whether to set the defensive flag.
*/
enableDefensive(active: boolean): void;
/**
* This method is a wrapper around [`sqlite3_db_filename()`](https://sqlite.org/c3ref/db_filename.html)
* @since v24.0.0
@@ -413,21 +426,74 @@ declare module "node:sqlite" {
*/
prepare(sql: string): StatementSync;
/**
* Creates a new `SQLTagStore`, which is an LRU (Least Recently Used) cache for
* storing prepared statements. This allows for the efficient reuse of prepared
* statements by tagging them with a unique identifier.
* Creates a new {@link SQLTagStore}, which is a Least Recently Used (LRU) cache
* for storing prepared statements. This allows for the efficient reuse of
* prepared statements by tagging them with a unique identifier.
*
* When a tagged SQL literal is executed, the `SQLTagStore` checks if a prepared
* statement for that specific SQL string already exists in the cache. If it does,
* the cached statement is used. If not, a new prepared statement is created,
* executed, and then stored in the cache for future use. This mechanism helps to
* avoid the overhead of repeatedly parsing and preparing the same SQL statements.
* statement for the corresponding SQL query string already exists in the cache.
* If it does, the cached statement is used. If not, a new prepared statement is
* created, executed, and then stored in the cache for future use. This mechanism
* helps to avoid the overhead of repeatedly parsing and preparing the same SQL
* statements.
*
* Tagged statements bind the placeholder values from the template literal as
* parameters to the underlying prepared statement. For example:
*
* ```js
* sqlTagStore.get`SELECT ${value}`;
* ```
*
* is equivalent to:
*
* ```js
* db.prepare('SELECT ?').get(value);
* ```
*
* However, in the first example, the tag store will cache the underlying prepared
* statement for future use.
*
* > **Note:** The `${value}` syntax in tagged statements _binds_ a parameter to
* > the prepared statement. This differs from its behavior in _untagged_ template
* > literals, where it performs string interpolation.
* >
* > ```js
* > // This a safe example of binding a parameter to a tagged statement.
* > sqlTagStore.run`INSERT INTO t1 (id) VALUES (${id})`;
* >
* > // This is an *unsafe* example of an untagged template string.
* > // `id` is interpolated into the query text as a string.
* > // This can lead to SQL injection and data corruption.
* > db.run(`INSERT INTO t1 (id) VALUES (${id})`);
* > ```
*
* The tag store will match a statement from the cache if the query strings
* (including the positions of any bound placeholders) are identical.
*
* ```js
* // The following statements will match in the cache:
* sqlTagStore.get`SELECT * FROM t1 WHERE id = ${id} AND active = 1`;
* sqlTagStore.get`SELECT * FROM t1 WHERE id = ${12345} AND active = 1`;
*
* // The following statements will not match, as the query strings
* // and bound placeholders differ:
* sqlTagStore.get`SELECT * FROM t1 WHERE id = ${id} AND active = 1`;
* sqlTagStore.get`SELECT * FROM t1 WHERE id = 12345 AND active = 1`;
*
* // The following statements will not match, as matches are case-sensitive:
* sqlTagStore.get`SELECT * FROM t1 WHERE id = ${id} AND active = 1`;
* sqlTagStore.get`select * from t1 where id = ${id} and active = 1`;
* ```
*
* The only way of binding parameters in tagged statements is with the `${value}`
* syntax. Do not add parameter binding placeholders (`?` etc.) to the SQL query
* string itself.
*
* ```js
* import { DatabaseSync } from 'node:sqlite';
*
* const db = new DatabaseSync(':memory:');
* const sql = db.createSQLTagStore();
* const sql = db.createTagStore();
*
* db.exec('CREATE TABLE users (id INT, name TEXT)');
*
@@ -437,8 +503,8 @@ declare module "node:sqlite" {
* sql.run`INSERT INTO users VALUES (2, 'Bob')`;
*
* // Using the 'get' method to retrieve a single row.
* const id = 1;
* const user = sql.get`SELECT * FROM users WHERE id = ${id}`;
* const name = 'Alice';
* const user = sql.get`SELECT * FROM users WHERE name = ${name}`;
* console.log(user); // { id: 1, name: 'Alice' }
*
* // Using the 'all' method to retrieve all rows.
@@ -450,6 +516,7 @@ declare module "node:sqlite" {
* // ]
* ```
* @since v24.9.0
* @param maxSize The maximum number of prepared statements to cache. **Default**: `1000`.
* @returns A new SQL tag store for caching prepared statements.
*/
createTagStore(maxSize?: number): SQLTagStore;
@@ -468,6 +535,8 @@ declare module "node:sqlite" {
* [`sqlite3changeset_apply()`](https://www.sqlite.org/session/sqlite3changeset_apply.html).
*
* ```js
* import { DatabaseSync } from 'node:sqlite';
*
* const sourceDb = new DatabaseSync(':memory:');
* const targetDb = new DatabaseSync(':memory:');
*
@@ -525,26 +594,39 @@ declare module "node:sqlite" {
* [`sqlite3session_delete()`](https://www.sqlite.org/session/sqlite3session_delete.html).
*/
close(): void;
/**
* Closes the session. If the session is already closed, does nothing.
* @since v24.9.0
*/
[Symbol.dispose](): void;
}
/**
* This class represents a single LRU (Least Recently Used) cache for storing
* prepared statements.
*
* Instances of this class are created via the database.createSQLTagStore() method,
* not by using a constructor. The store caches prepared statements based on the
* provided SQL query string. When the same query is seen again, the store
* Instances of this class are created via the `database.createTagStore()`
* method, not by using a constructor. The store caches prepared statements based
* on the provided SQL query string. When the same query is seen again, the store
* retrieves the cached statement and safely applies the new values through
* parameter binding, thereby preventing attacks like SQL injection.
*
* The cache has a maxSize that defaults to 1000 statements, but a custom size can
* be provided (e.g., database.createSQLTagStore(100)). All APIs exposed by this
* be provided (e.g., `database.createTagStore(100)`). All APIs exposed by this
* class execute synchronously.
* @since v24.9.0
*/
interface SQLTagStore {
/**
* Executes the given SQL query and returns all resulting rows as an array of objects.
* Executes the given SQL query and returns all resulting rows as an array of
* objects.
*
* This function is intended to be used as a template literal tag, not to be
* called directly.
* @since v24.9.0
* @param stringElements Template literal elements containing the SQL
* query.
* @param boundParameters Parameter values to be bound to placeholders in the template string.
* @returns An array of objects representing the rows returned by the query.
*/
all(
stringElements: TemplateStringsArray,
@@ -552,7 +634,15 @@ declare module "node:sqlite" {
): Record<string, SQLOutputValue>[];
/**
* Executes the given SQL query and returns the first resulting row as an object.
*
* This function is intended to be used as a template literal tag, not to be
* called directly.
* @since v24.9.0
* @param stringElements Template literal elements containing the SQL
* query.
* @param boundParameters Parameter values to be bound to placeholders in the template string.
* @returns An object representing the first row returned by
* the query, or `undefined` if no rows are returned.
*/
get(
stringElements: TemplateStringsArray,
@@ -560,7 +650,14 @@ declare module "node:sqlite" {
): Record<string, SQLOutputValue> | undefined;
/**
* Executes the given SQL query and returns an iterator over the resulting rows.
*
* This function is intended to be used as a template literal tag, not to be
* called directly.
* @since v24.9.0
* @param stringElements Template literal elements containing the SQL
* query.
* @param boundParameters Parameter values to be bound to placeholders in the template string.
* @returns An iterator that yields objects representing the rows returned by the query.
*/
iterate(
stringElements: TemplateStringsArray,
@@ -568,15 +665,21 @@ declare module "node:sqlite" {
): NodeJS.Iterator<Record<string, SQLOutputValue>>;
/**
* Executes the given SQL query, which is expected to not return any rows (e.g., INSERT, UPDATE, DELETE).
*
* This function is intended to be used as a template literal tag, not to be
* called directly.
* @since v24.9.0
* @param stringElements Template literal elements containing the SQL
* query.
* @param boundParameters Parameter values to be bound to placeholders in the template string.
* @returns An object containing information about the execution, including `changes` and `lastInsertRowid`.
*/
run(stringElements: TemplateStringsArray, ...boundParameters: SQLInputValue[]): StatementResultingChanges;
/**
* A read-only property that returns the number of prepared statements currently in the cache.
* @since v24.9.0
* @returns The maximum number of prepared statements the cache can hold.
*/
size(): number;
readonly size: number;
/**
* A read-only property that returns the maximum number of prepared statements the cache can hold.
* @since v24.9.0
+27 -4
View File
@@ -863,11 +863,20 @@ declare module "stream" {
* @since v0.9.4
* @param chunk Optional data to write. For streams not operating in object mode, `chunk` must be a {string}, {Buffer},
* {TypedArray} or {DataView}. For object mode streams, `chunk` may be any JavaScript value other than `null`.
* @param [encoding='utf8'] The encoding, if `chunk` is a string.
* @param callback Callback for when this chunk of data is flushed.
* @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
*/
write(chunk: any, callback?: (error: Error | null | undefined) => void): boolean;
/**
* Writes data to the stream, with an explicit encoding for string data.
* @see {@link Writable.write} for full details.
* @since v0.9.4
* @param chunk Optional data to write. For streams not operating in object mode, `chunk` must be a {string}, {Buffer},
* {TypedArray} or {DataView}. For object mode streams, `chunk` may be any JavaScript value other than `null`.
* @param encoding The encoding, if `chunk` is a string.
* @param callback Callback for when this chunk of data is flushed.
* @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
*/
write(chunk: any, encoding: BufferEncoding, callback?: (error: Error | null | undefined) => void): boolean;
/**
* The `writable.setDefaultEncoding()` method sets the default `encoding` for a `Writable` stream.
@@ -892,13 +901,27 @@ declare module "stream" {
* // Writing more now is not allowed!
* ```
* @since v0.9.4
* @param cb Callback for when the stream is finished.
*/
end(cb?: () => void): this;
/**
* Signals that no more data will be written, with one final chunk of data.
* @see {@link Writable.end} for full details.
* @since v0.9.4
* @param chunk Optional data to write. For streams not operating in object mode, `chunk` must be a {string}, {Buffer},
* {TypedArray} or {DataView}. For object mode streams, `chunk` may be any JavaScript value other than `null`.
* @param cb Callback for when the stream is finished.
*/
end(chunk: any, cb?: () => void): this;
/**
* Signals that no more data will be written, with one final chunk of data.
* @see {@link Writable.end} for full details.
* @since v0.9.4
* @param chunk Optional data to write. For streams not operating in object mode, `chunk` must be a {string}, {Buffer},
* {TypedArray} or {DataView}. For object mode streams, `chunk` may be any JavaScript value other than `null`.
* @param encoding The encoding if `chunk` is a string
* @param callback Callback for when the stream is finished.
* @param cb Callback for when the stream is finished.
*/
end(cb?: () => void): this;
end(chunk: any, cb?: () => void): this;
end(chunk: any, encoding: BufferEncoding, cb?: () => void): this;
/**
* The `writable.cork()` method forces all written data to be buffered in memory.
+6 -6
View File
@@ -105,7 +105,7 @@ declare module "stream/web" {
}
interface ReadableStreamReadDoneResult<T> {
done: true;
value?: T;
value: T | undefined;
}
type ReadableStreamReadResult<T> = ReadableStreamReadValueResult<T> | ReadableStreamReadDoneResult<T>;
interface ReadableByteStreamControllerCallback {
@@ -237,7 +237,7 @@ declare module "stream/web" {
new(): ReadableStreamBYOBRequest;
};
interface ReadableByteStreamController {
readonly byobRequest: undefined;
readonly byobRequest: ReadableStreamBYOBRequest | null;
readonly desiredSize: number | null;
close(): void;
enqueue(chunk: ArrayBufferView): void;
@@ -250,7 +250,7 @@ declare module "stream/web" {
interface ReadableStreamDefaultController<R = any> {
readonly desiredSize: number | null;
close(): void;
enqueue(chunk?: R): void;
enqueue(chunk: R): void;
error(e?: any): void;
}
const ReadableStreamDefaultController: {
@@ -279,7 +279,7 @@ declare module "stream/web" {
};
interface TransformStreamDefaultController<O = any> {
readonly desiredSize: number | null;
enqueue(chunk?: O): void;
enqueue(chunk: O): void;
error(reason?: any): void;
terminate(): void;
}
@@ -315,7 +315,7 @@ declare module "stream/web" {
abort(reason?: any): Promise<void>;
close(): Promise<void>;
releaseLock(): void;
write(chunk?: W): Promise<void>;
write(chunk: W): Promise<void>;
}
const WritableStreamDefaultWriter: {
prototype: WritableStreamDefaultWriter;
@@ -339,7 +339,7 @@ declare module "stream/web" {
size?: QueuingStrategySize<T>;
}
interface QueuingStrategySize<T = any> {
(chunk?: T): number;
(chunk: T): number;
}
interface QueuingStrategyInit {
/**
+24 -14
View File
@@ -81,6 +81,7 @@
declare module "node:test" {
import { AssertMethodNames } from "node:assert";
import { Readable } from "node:stream";
import { URL } from "node:url";
import TestFn = test.TestFn;
import TestOptions = test.TestOptions;
/**
@@ -235,7 +236,7 @@ declare module "node:test" {
}
interface RunOptions {
/**
* If a number is provided, then that many test processes would run in parallel, where each process corresponds to one test file.
* If a number is provided, then that many tests would run asynchronously (they are still managed by the single-threaded event loop).
* If `true`, it would run `os.availableParallelism() - 1` test files in parallel. If `false`, it would only run one test file at a time.
* @default false
*/
@@ -1304,6 +1305,11 @@ declare module "node:test" {
* @since v22.6.0
*/
readonly filePath: string | undefined;
/**
* The name of the suite and each of its ancestors, separated by `>`.
* @since v22.3.0, v20.16.0
*/
readonly fullName: string;
/**
* The name of the suite.
* @since v18.8.0, v16.18.0
@@ -1711,7 +1717,7 @@ declare module "node:test" {
* @param specifier A string identifying the module to mock.
* @param options Optional configuration options for the mock module.
*/
module(specifier: string, options?: MockModuleOptions): MockModuleContext;
module(specifier: string | URL, options?: MockModuleOptions): MockModuleContext;
/**
* Creates a mock for a property value on an object. This allows you to track and control access to a specific property,
* including how many times it is read (getter) or written (setter), and to restore the original value after mocking.
@@ -2052,24 +2058,28 @@ declare module "node:test" {
*/
enable(options?: MockTimersOptions): void;
/**
* You can use the `.setTime()` method to manually move the mocked date to another time. This method only accepts a positive integer.
* Note: This method will execute any mocked timers that are in the past from the new time.
* In the below example we are setting a new time for the mocked date.
* Sets the current Unix timestamp that will be used as reference for any mocked
* `Date` objects.
*
* ```js
* import assert from 'node:assert';
* import { test } from 'node:test';
* test('sets the time of a date object', (context) => {
* // Optionally choose what to mock
* context.mock.timers.enable({ apis: ['Date'], now: 100 });
* assert.strictEqual(Date.now(), 100);
* // Advance in time will also advance the date
* context.mock.timers.setTime(1000);
* context.mock.timers.tick(200);
* assert.strictEqual(Date.now(), 1200);
*
* test('runAll functions following the given order', (context) => {
* const now = Date.now();
* const setTime = 1000;
* // Date.now is not mocked
* assert.deepStrictEqual(Date.now(), now);
*
* context.mock.timers.enable({ apis: ['Date'] });
* context.mock.timers.setTime(setTime);
* // Date.now is now 1000
* assert.strictEqual(Date.now(), setTime);
* });
* ```
* @since v21.2.0, v20.11.0
*/
setTime(time: number): void;
setTime(milliseconds: number): void;
/**
* This function restores the default behavior of all mocks that were previously
* created by this `MockTimers` instance and disassociates the mocks
+23 -13
View File
@@ -15,31 +15,31 @@ declare module "tls" {
import * as stream from "stream";
const CLIENT_RENEG_LIMIT: number;
const CLIENT_RENEG_WINDOW: number;
interface Certificate {
interface Certificate extends NodeJS.Dict<string | string[]> {
/**
* Country code.
*/
C: string;
C?: string | string[];
/**
* Street.
*/
ST: string;
ST?: string | string[];
/**
* Locality.
*/
L: string;
L?: string | string[];
/**
* Organization.
*/
O: string;
O?: string | string[];
/**
* Organizational unit.
*/
OU: string;
OU?: string | string[];
/**
* Common name.
*/
CN: string;
CN?: string | string[];
}
interface PeerCertificate {
/**
@@ -200,12 +200,6 @@ declare module "tls" {
* An optional Buffer instance containing a TLS session.
*/
session?: Buffer | undefined;
/**
* If true, specifies that the OCSP status request extension will be
* added to the client hello and an 'OCSPResponse' event will be
* emitted on the socket before establishing a secure communication
*/
requestOCSP?: boolean | undefined;
}
/**
* Performs transparent encryption of written data and all required TLS
@@ -245,6 +239,10 @@ declare module "tls" {
* When a handshake is completed but not ALPN protocol was selected, tlsSocket.alpnProtocol equals false.
*/
alpnProtocol: string | false | null;
/**
* String containing the server name requested via SNI (Server Name Indication) TLS extension.
*/
servername: string | false | null;
/**
* Returns an object representing the local certificate. The returned object has
* some properties corresponding to the fields of the certificate.
@@ -482,31 +480,37 @@ declare module "tls" {
exportKeyingMaterial(length: number, label: string, context: Buffer): NonSharedBuffer;
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "OCSPResponse", listener: (response: NonSharedBuffer) => void): this;
addListener(event: "secure", listener: () => void): this;
addListener(event: "secureConnect", listener: () => void): this;
addListener(event: "session", listener: (session: NonSharedBuffer) => void): this;
addListener(event: "keylog", listener: (line: NonSharedBuffer) => void): this;
emit(event: string | symbol, ...args: any[]): boolean;
emit(event: "OCSPResponse", response: NonSharedBuffer): boolean;
emit(event: "secure"): boolean;
emit(event: "secureConnect"): boolean;
emit(event: "session", session: NonSharedBuffer): boolean;
emit(event: "keylog", line: NonSharedBuffer): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: "OCSPResponse", listener: (response: NonSharedBuffer) => void): this;
on(event: "secure", listener: () => void): this;
on(event: "secureConnect", listener: () => void): this;
on(event: "session", listener: (session: NonSharedBuffer) => void): this;
on(event: "keylog", listener: (line: NonSharedBuffer) => void): this;
once(event: string, listener: (...args: any[]) => void): this;
once(event: "OCSPResponse", listener: (response: NonSharedBuffer) => void): this;
once(event: "secure", listener: () => void): this;
once(event: "secureConnect", listener: () => void): this;
once(event: "session", listener: (session: NonSharedBuffer) => void): this;
once(event: "keylog", listener: (line: NonSharedBuffer) => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: "OCSPResponse", listener: (response: NonSharedBuffer) => void): this;
prependListener(event: "secure", listener: () => void): this;
prependListener(event: "secureConnect", listener: () => void): this;
prependListener(event: "session", listener: (session: NonSharedBuffer) => void): this;
prependListener(event: "keylog", listener: (line: NonSharedBuffer) => void): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: "OCSPResponse", listener: (response: NonSharedBuffer) => void): this;
prependOnceListener(event: "secure", listener: () => void): this;
prependOnceListener(event: "secureConnect", listener: () => void): this;
prependOnceListener(event: "session", listener: (session: NonSharedBuffer) => void): this;
prependOnceListener(event: "keylog", listener: (line: NonSharedBuffer) => void): this;
@@ -550,6 +554,12 @@ declare module "tls" {
* @default true
*/
rejectUnauthorized?: boolean | undefined;
/**
* If true, specifies that the OCSP status request extension will be
* added to the client hello and an 'OCSPResponse' event will be
* emitted on the socket before establishing a secure communication.
*/
requestOCSP?: boolean | undefined;
}
interface TlsOptions extends SecureContextOptions, CommonConnectionOptions, net.ServerOpts {
/**
+24 -2
View File
@@ -80,7 +80,7 @@ declare module "url" {
* function getURL(req) {
* const proto = req.headers['x-forwarded-proto'] || 'https';
* const host = req.headers['x-forwarded-host'] || req.headers.host || 'example.com';
* return new URL(req.url || '/', `${proto}://${host}`);
* return new URL(`${proto}://${host}${req.url || '/'}`);
* }
* ```
*
@@ -90,7 +90,7 @@ declare module "url" {
*
* ```js
* function getURL(req) {
* return new URL(req.url || '/', 'https://example.com');
* return new URL(`https://example.com${req.url || '/'}`);
* }
* ```
* @since v0.1.25
@@ -334,6 +334,19 @@ declare module "url" {
* new URL('file:///hello world').pathname; // Incorrect: /hello%20world
* fileURLToPath('file:///hello world'); // Correct: /hello world (POSIX)
* ```
*
* **Security Considerations:**
*
* This function decodes percent-encoded characters, including encoded dot-segments
* (`%2e` as `.` and `%2e%2e` as `..`), and then normalizes the resulting path.
* This means that encoded directory traversal sequences (such as `%2e%2e`) are
* decoded and processed as actual path traversal, even though encoded slashes
* (`%2F`, `%5C`) are correctly rejected.
*
* **Applications must not rely on `fileURLToPath()` alone to prevent directory
* traversal attacks.** Always perform explicit path validation and security checks
* on the returned path value to ensure it remains within expected boundaries
* before using it for file system operations.
* @since v10.12.0
* @param url The file URL string or URL object to convert to a path.
* @return The fully-resolved platform-specific Node.js file path.
@@ -344,6 +357,15 @@ declare module "url" {
* representation of the path, a `Buffer` is returned. This conversion is
* helpful when the input URL contains percent-encoded segments that are
* not valid UTF-8 / Unicode sequences.
*
* **Security Considerations:**
*
* This function has the same security considerations as `url.fileURLToPath()`.
* It decodes percent-encoded characters, including encoded dot-segments
* (`%2e` as `.` and `%2e%2e` as `..`), and normalizes the path. **Applications
* must not rely on this function alone to prevent directory traversal attacks.**
* Always perform explicit path validation on the returned buffer value before
* using it for file system operations.
* @since v24.3.0
* @param url The file URL string or URL object to convert to a path.
* @returns The fully-resolved platform-specific Node.js file path
+14 -3
View File
@@ -254,6 +254,9 @@ declare module "util" {
* Returns an array of call site objects containing the stack of
* the caller function.
*
* Unlike accessing an `error.stack`, the result returned from this API is not
* interfered with `Error.prepareStackTrace`.
*
* ```js
* import { getCallSites } from 'node:util';
*
@@ -266,7 +269,7 @@ declare module "util" {
* console.log(`Function Name: ${callSite.functionName}`);
* console.log(`Script Name: ${callSite.scriptName}`);
* console.log(`Line Number: ${callSite.lineNumber}`);
* console.log(`Column Number: ${callSite.column}`);
* console.log(`Column Number: ${callSite.columnNumber}`);
* });
* // CallSite 1:
* // Function Name: exampleFunction
@@ -758,7 +761,7 @@ declare module "util" {
*
* ```js
* import { debuglog } from 'node:util';
* const log = debuglog('foo');
* const log = debuglog('foo-bar');
*
* log('hi there, it\'s foo-bar [%d]', 2333);
* ```
@@ -792,6 +795,14 @@ declare module "util" {
*/
export function debuglog(section: string, callback?: (fn: DebugLoggerFunction) => void): DebugLogger;
export { debuglog as debug };
export interface DeprecateOptions {
/**
* When false do not change the prototype of object while emitting the deprecation warning.
* @since v24.12.0
* @default true
*/
modifyPrototype?: boolean | undefined;
}
/**
* The `util.deprecate()` method wraps `fn` (which may be a function or class) in
* such a way that it is marked as deprecated.
@@ -852,7 +863,7 @@ declare module "util" {
* @param code A deprecation code. See the `list of deprecated APIs` for a list of codes.
* @return The deprecated function wrapped to emit a warning.
*/
export function deprecate<T extends Function>(fn: T, msg: string, code?: string): T;
export function deprecate<T extends Function>(fn: T, msg: string, code?: string, options?: DeprecateOptions): T;
export interface IsDeepStrictEqualOptions {
/**
* If `true`, prototype and constructor
+31 -1
View File
@@ -304,7 +304,6 @@ declare module "v8" {
* ```
* @param ctor The constructor that can be used to search on the prototype chain in order to filter target objects in the heap.
* @since v20.13.0
* @experimental
*/
function queryObjects(ctor: Function): number | string[];
function queryObjects(ctor: Function, options: { format: "count" }): number;
@@ -401,6 +400,21 @@ declare module "v8" {
* @since v12.8.0
*/
function getHeapCodeStatistics(): HeapCodeStatistics;
/**
* @since v24.12.0
*/
interface SyncCPUProfileHandle {
/**
* Stopping collecting the profile and return the profile data.
* @since v24.12.0
*/
stop(): string;
/**
* Stopping collecting the profile and the profile will be discarded.
* @since v24.12.0
*/
[Symbol.dispose](): void;
}
/**
* @since v24.8.0
*/
@@ -466,6 +480,17 @@ declare module "v8" {
* @since v23.10.0, v22.15.0
*/
function isStringOneByteRepresentation(content: string): boolean;
/**
* Starting a CPU profile then return a `SyncCPUProfileHandle` object. This API supports `using` syntax.
*
* ```js
* const handle = v8.startCpuProfile();
* const profile = handle.stop();
* console.log(profile);
* ```
* @since v24.12.0
*/
function startCpuProfile(): SyncCPUProfileHandle;
/**
* @since v8.0.0
*/
@@ -706,6 +731,11 @@ declare module "v8" {
* @since v19.6.0, v18.15.0
*/
stop(): GCProfilerResult;
/**
* Stop collecting GC data, and discard the profile.
* @since v24.13.0
*/
[Symbol.dispose](): void;
}
interface GCProfilerResult {
version: number;
+27 -12
View File
@@ -748,8 +748,8 @@ declare module "vm" {
* // The "secret" variable refers to the global variable we added to
* // "contextifiedObject" when creating the context.
* export default secret;
* `, { context: referencingModule.context });
* moduleMap.set(specifier, linkedModule);
* `, { context: module.context });
* moduleMap.set(specifier, requestedModule);
* // Resolve the dependencies of the new module as well.
* resolveAndLinkDependencies(requestedModule);
* }
@@ -819,19 +819,34 @@ declare module "vm" {
*/
status: ModuleStatus;
/**
* Evaluate the module.
* Evaluate the module and its depenendencies. Corresponds to the [Evaluate() concrete method](https://tc39.es/ecma262/#sec-moduleevaluation)
* field of [Cyclic Module Record](https://tc39.es/ecma262/#sec-cyclic-module-records)s in the ECMAScript specification.
*
* This must be called after the module has been linked; otherwise it will reject.
* It could be called also when the module has already been evaluated, in which
* case it will either do nothing if the initial evaluation ended in success
* (`module.status` is `'evaluated'`) or it will re-throw the exception that the
* initial evaluation resulted in (`module.status` is `'errored'`).
* If the module is a `vm.SourceTextModule`, `evaluate()` must be called after the module has been instantiated;
* otherwise `evaluate()` will return a rejected promise.
*
* This method cannot be called while the module is being evaluated
* (`module.status` is `'evaluating'`).
* For a `vm.SourceTextModule`, the promise returned by `evaluate()` may be fulfilled either synchronously or asynchronously:
* 1. If the `vm.SourceTextModule` has no top-level `await` in itself or any of its dependencies, the promise will be
* fulfilled synchronously after the module and all its dependencies have been evaluated.
* 1. If the evaluation succeeds, the promise will be _synchronously_ resolved to `undefined`.
* 2. If the evaluation results in an exception, the promise will be _synchronously_ rejected with the exception that causes the evaluation to fail, which is the same as `module.error`.
* 2. If the `vm.SourceTextModule` has top-level `await` in itself or any of its dependencies, the promise will be fulfilled asynchronously after the module and all its dependencies have been evaluated.
* 1. If the evaluation succeeds, the promise will be _asynchronously_ resolved to `undefined`.
* 2. If the evaluation results in an exception, the promise will be _asynchronously_ rejected with the exception that causes the evaluation to fail.
*
* Corresponds to the [Evaluate() concrete method](https://tc39.es/ecma262/#sec-moduleevaluation) field of [Cyclic Module Record](https://tc39.es/ecma262/#sec-cyclic-module-records) s in the
* ECMAScript specification.
* If the module is a `vm.SyntheticModule`, `evaluate()` always returns a promise that fulfills synchronously,
* see the specification of [Evaluate() of a Synthetic Module Record](https://tc39.es/ecma262/#sec-smr-Evaluate):
* 1. If the `evaluateCallback` passed to its constructor throws an exception synchronously, `evaluate()` returns a promise that will be synchronously rejected with that exception.
* 2. If the `evaluateCallback` does not throw an exception, `evaluate()` returns a promise that will be synchronously resolved to `undefined`.
*
* The `evaluateCallback` of a `vm.SyntheticModule` is executed synchronously within the `evaluate()` call, and its return value is discarded. This means if `evaluateCallback` is an asynchronous function, the promise
* returned by `evaluate()` will not reflect its asynchronous behavior, and any rejections from an asynchronous `evaluateCallback` will be lost.
*
* evaluate() could also be called again after the module has already been evaluated, in which case:
* 1. If the initial evaluation ended in success (`module.status` is `'evaluated'`), it will do nothing and return a promise that resolves to `undefined`.
* 2. If the initial evaluation resulted in an exception (`module.status` is `'errored'`), it will re-reject the exception that the initial evaluation resulted in.
*
* This method cannot be called while the module is being evaluated (`module.status` is `'evaluating'`).
* @return Fulfills with `undefined` upon success.
*/
evaluate(options?: ModuleEvaluateOptions): Promise<void>;
+12
View File
@@ -3,15 +3,19 @@ export {};
import * as undici from "undici-types";
type _CloseEvent = typeof globalThis extends { onmessage: any } ? {} : undici.CloseEvent;
type _CloseEventInit = typeof globalThis extends { onmessage: any } ? {} : undici.CloseEventInit;
type _EventSource = typeof globalThis extends { onmessage: any } ? {} : undici.EventSource;
type _EventSourceInit = typeof globalThis extends { onmessage: any } ? {} : undici.EventSourceInit;
type _FormData = typeof globalThis extends { onmessage: any } ? {} : undici.FormData;
type _Headers = typeof globalThis extends { onmessage: any } ? {} : undici.Headers;
type _MessageEvent = typeof globalThis extends { onmessage: any } ? {} : undici.MessageEvent;
type _MessageEventInit = typeof globalThis extends { onmessage: any } ? {} : undici.MessageEventInit;
type _Request = typeof globalThis extends { onmessage: any } ? {} : undici.Request;
type _RequestInit = typeof globalThis extends { onmessage: any } ? {} : undici.RequestInit;
type _Response = typeof globalThis extends { onmessage: any } ? {} : undici.Response;
type _ResponseInit = typeof globalThis extends { onmessage: any } ? {} : undici.ResponseInit;
type _WebSocket = typeof globalThis extends { onmessage: any } ? {} : undici.WebSocket;
type _WebSocketInit = typeof globalThis extends { onmessage: any } ? {} : undici.WebSocketInit;
declare global {
function fetch(
@@ -22,9 +26,13 @@ declare global {
interface CloseEvent extends _CloseEvent {}
var CloseEvent: typeof globalThis extends { onmessage: any; CloseEvent: infer T } ? T : typeof undici.CloseEvent;
interface CloseEventInit extends _CloseEventInit {}
interface EventSource extends _EventSource {}
var EventSource: typeof globalThis extends { onmessage: any; EventSource: infer T } ? T : typeof undici.EventSource;
interface EventSourceInit extends _EventSourceInit {}
interface FormData extends _FormData {}
var FormData: typeof globalThis extends { onmessage: any; FormData: infer T } ? T : typeof undici.FormData;
@@ -35,6 +43,8 @@ declare global {
var MessageEvent: typeof globalThis extends { onmessage: any; MessageEvent: infer T } ? T
: typeof undici.MessageEvent;
interface MessageEventInit extends _MessageEventInit {}
interface Request extends _Request {}
var Request: typeof globalThis extends { onmessage: any; Request: infer T } ? T : typeof undici.Request;
@@ -47,4 +57,6 @@ declare global {
interface WebSocket extends _WebSocket {}
var WebSocket: typeof globalThis extends { onmessage: any; WebSocket: infer T } ? T : typeof undici.WebSocket;
interface WebSocketInit extends _WebSocketInit {}
}
+19 -21
View File
@@ -3,7 +3,7 @@
* JavaScript in parallel. To access it:
*
* ```js
* import worker from 'node:worker_threads';
* import worker_threads from 'node:worker_threads';
* ```
*
* Workers (threads) are useful for performing CPU-intensive JavaScript operations.
@@ -33,8 +33,8 @@
* workerData: script,
* });
* worker.on('message', resolve);
* worker.on('error', reject);
* worker.on('exit', (code) => {
* worker.once('error', reject);
* worker.once('exit', (code) => {
* if (code !== 0)
* reject(new Error(`Worker stopped with exit code ${code}`));
* });
@@ -57,8 +57,8 @@
declare module "worker_threads" {
import { Context } from "node:vm";
import { EventEmitter, NodeEventTarget } from "node:events";
import { EventLoopUtilityFunction } from "node:perf_hooks";
import { FileHandle } from "node:fs/promises";
import { Performance } from "node:perf_hooks";
import { Readable, Writable } from "node:stream";
import { ReadableStream, TransformStream, WritableStream } from "node:stream/web";
import { URL } from "node:url";
@@ -91,9 +91,7 @@ declare module "worker_threads" {
readonly port1: MessagePort;
readonly port2: MessagePort;
}
interface WorkerPerformance {
eventLoopUtilization: EventLoopUtilityFunction;
}
interface WorkerPerformance extends Pick<Performance, "eventLoopUtilization"> {}
type Transferable =
| ArrayBuffer
| MessagePort
@@ -410,7 +408,7 @@ declare module "worker_threads" {
readonly resourceLimits?: ResourceLimits | undefined;
/**
* An object that can be used to query performance information from a worker
* instance. Similar to `perf_hooks.performance`.
* instance.
* @since v15.1.0, v14.17.0, v12.22.0
*/
readonly performance: WorkerPerformance;
@@ -446,8 +444,8 @@ declare module "worker_threads" {
*/
terminate(): Promise<number>;
/**
* This method returns a `Promise` that will resolve to an object identical to `process.threadCpuUsage()`,
* or reject with an `ERR_WORKER_NOT_RUNNING` error if the worker is no longer running.
* This method returns a `Promise` that will resolve to an object identical to {@link process.threadCpuUsage()},
* or reject with an [`ERR_WORKER_NOT_RUNNING`](https://nodejs.org/docs/latest-v24.x/api/errors.html#err_worker_not_running) error if the worker is no longer running.
* This methods allows the statistics to be observed from outside the actual thread.
* @since v24.6.0
*/
@@ -556,49 +554,49 @@ declare module "worker_threads" {
* @since v24.2.0
*/
[Symbol.asyncDispose](): Promise<void>;
addListener(event: "error", listener: (err: Error) => void): this;
addListener(event: "error", listener: (err: any) => void): this;
addListener(event: "exit", listener: (exitCode: number) => void): this;
addListener(event: "message", listener: (value: any) => void): this;
addListener(event: "messageerror", listener: (error: Error) => void): this;
addListener(event: "online", listener: () => void): this;
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
emit(event: "error", err: Error): boolean;
emit(event: "error", err: any): boolean;
emit(event: "exit", exitCode: number): boolean;
emit(event: "message", value: any): boolean;
emit(event: "messageerror", error: Error): boolean;
emit(event: "online"): boolean;
emit(event: string | symbol, ...args: any[]): boolean;
on(event: "error", listener: (err: Error) => void): this;
on(event: "error", listener: (err: any) => void): this;
on(event: "exit", listener: (exitCode: number) => void): this;
on(event: "message", listener: (value: any) => void): this;
on(event: "messageerror", listener: (error: Error) => void): this;
on(event: "online", listener: () => void): this;
on(event: string | symbol, listener: (...args: any[]) => void): this;
once(event: "error", listener: (err: Error) => void): this;
once(event: "error", listener: (err: any) => void): this;
once(event: "exit", listener: (exitCode: number) => void): this;
once(event: "message", listener: (value: any) => void): this;
once(event: "messageerror", listener: (error: Error) => void): this;
once(event: "online", listener: () => void): this;
once(event: string | symbol, listener: (...args: any[]) => void): this;
prependListener(event: "error", listener: (err: Error) => void): this;
prependListener(event: "error", listener: (err: any) => void): this;
prependListener(event: "exit", listener: (exitCode: number) => void): this;
prependListener(event: "message", listener: (value: any) => void): this;
prependListener(event: "messageerror", listener: (error: Error) => void): this;
prependListener(event: "online", listener: () => void): this;
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener(event: "error", listener: (err: Error) => void): this;
prependOnceListener(event: "error", listener: (err: any) => void): this;
prependOnceListener(event: "exit", listener: (exitCode: number) => void): this;
prependOnceListener(event: "message", listener: (value: any) => void): this;
prependOnceListener(event: "messageerror", listener: (error: Error) => void): this;
prependOnceListener(event: "online", listener: () => void): this;
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
removeListener(event: "error", listener: (err: Error) => void): this;
removeListener(event: "error", listener: (err: any) => void): this;
removeListener(event: "exit", listener: (exitCode: number) => void): this;
removeListener(event: "message", listener: (value: any) => void): this;
removeListener(event: "messageerror", listener: (error: Error) => void): this;
removeListener(event: "online", listener: () => void): this;
removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
off(event: "error", listener: (err: Error) => void): this;
off(event: "error", listener: (err: any) => void): this;
off(event: "exit", listener: (exitCode: number) => void): this;
off(event: "message", listener: (value: any) => void): this;
off(event: "messageerror", listener: (error: Error) => void): this;
@@ -691,7 +689,7 @@ declare module "worker_threads" {
var locks: LockManager;
/**
* Mark an object as not transferable. If `object` occurs in the transfer list of
* a `port.postMessage()` call, it is ignored.
* a {@link MessagePort.postMessage port.postMessage()} call, it is ignored.
*
* In particular, this makes sense for objects that can be cloned, rather than
* transferred, and which are used by other objects on the sending side.
@@ -813,13 +811,13 @@ declare module "worker_threads" {
*
* if (isMainThread) {
* setEnvironmentData('Hello', 'World!');
* const worker = new Worker(__filename);
* const worker = new Worker(new URL(import.meta.url));
* } else {
* console.log(getEnvironmentData('Hello')); // Prints 'World!'.
* }
* ```
* @since v15.12.0, v14.18.0
* @param key Any arbitrary, cloneable JavaScript value that can be used as a {Map} key.
* @param key Any arbitrary, cloneable JavaScript value that can be used as a {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map Map} key.
*/
function getEnvironmentData(key: Serializable): Serializable;
/**
+68 -4
View File
@@ -108,10 +108,14 @@ declare module "zlib" {
*/
chunkSize?: number | undefined;
windowBits?: number | undefined;
level?: number | undefined; // compression only
memLevel?: number | undefined; // compression only
strategy?: number | undefined; // compression only
dictionary?: NodeJS.ArrayBufferView | ArrayBuffer | undefined; // deflate/inflate only, empty dictionary by default
/** compression only */
level?: number | undefined;
/** compression only */
memLevel?: number | undefined;
/** compression only */
strategy?: number | undefined;
/** deflate/inflate only, empty dictionary by default */
dictionary?: NodeJS.ArrayBufferView | ArrayBuffer | undefined;
/**
* If `true`, returns an object with `buffer` and `engine`.
*/
@@ -201,24 +205,84 @@ declare module "zlib" {
interface ZlibReset {
reset(): void;
}
/**
* @since v10.16.0
*/
class BrotliCompress extends stream.Transform {
constructor(options?: BrotliOptions);
}
interface BrotliCompress extends stream.Transform, Zlib {}
/**
* @since v10.16.0
*/
class BrotliDecompress extends stream.Transform {
constructor(options?: BrotliOptions);
}
interface BrotliDecompress extends stream.Transform, Zlib {}
/**
* @since v0.5.8
*/
class Gzip extends stream.Transform {
constructor(options?: ZlibOptions);
}
interface Gzip extends stream.Transform, Zlib {}
/**
* @since v0.5.8
*/
class Gunzip extends stream.Transform {
constructor(options?: ZlibOptions);
}
interface Gunzip extends stream.Transform, Zlib {}
/**
* @since v0.5.8
*/
class Deflate extends stream.Transform {
constructor(options?: ZlibOptions);
}
interface Deflate extends stream.Transform, Zlib, ZlibReset, ZlibParams {}
/**
* @since v0.5.8
*/
class Inflate extends stream.Transform {
constructor(options?: ZlibOptions);
}
interface Inflate extends stream.Transform, Zlib, ZlibReset {}
/**
* @since v0.5.8
*/
class DeflateRaw extends stream.Transform {
constructor(options?: ZlibOptions);
}
interface DeflateRaw extends stream.Transform, Zlib, ZlibReset, ZlibParams {}
/**
* @since v0.5.8
*/
class InflateRaw extends stream.Transform {
constructor(options?: ZlibOptions);
}
interface InflateRaw extends stream.Transform, Zlib, ZlibReset {}
/**
* @since v0.5.8
*/
class Unzip extends stream.Transform {
constructor(options?: ZlibOptions);
}
interface Unzip extends stream.Transform, Zlib {}
/**
* @since v22.15.0
* @experimental
*/
class ZstdCompress extends stream.Transform {
constructor(options?: ZstdOptions);
}
interface ZstdCompress extends stream.Transform, Zlib {}
/**
* @since v22.15.0
* @experimental
*/
class ZstdDecompress extends stream.Transform {
constructor(options?: ZstdOptions);
}
interface ZstdDecompress extends stream.Transform, Zlib {}
/**
* Computes a 32-bit [Cyclic Redundancy Check](https://en.wikipedia.org/wiki/Cyclic_redundancy_check) checksum of `data`.
+1 -1
View File
@@ -8,7 +8,7 @@ This package contains type definitions for react (https://react.dev/).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react.
### Additional Details
* Last updated: Mon, 24 Nov 2025 09:38:12 GMT
* Last updated: Fri, 05 Jun 2026 20:10:10 GMT
* Dependencies: [csstype](https://npmjs.com/package/csstype)
# Credits
+13 -4
View File
@@ -30,6 +30,8 @@ export {};
declare const UNDEFINED_VOID_ONLY: unique symbol;
type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
type NativeSubmitEvent = SubmitEvent;
declare module "." {
export function unstable_useCacheRefresh(): () => void;
@@ -71,19 +73,19 @@ declare module "." {
/**
* The `<ViewTransition>` or its parent Component is mounted and there's no other `<ViewTransition>` with the same name being deleted.
*/
onEnter?: (instance: ViewTransitionInstance, types: Array<string>) => void;
onEnter?: (instance: ViewTransitionInstance, types: Array<string>) => void | (() => void);
/**
* The `<ViewTransition>` or its parent Component is unmounted and there's no other `<ViewTransition>` with the same name being deleted.
*/
onExit?: (instance: ViewTransitionInstance, types: Array<string>) => void;
onExit?: (instance: ViewTransitionInstance, types: Array<string>) => void | (() => void);
/**
* This `<ViewTransition>` is being mounted and another `<ViewTransition>` instance with the same name is being unmounted elsewhere.
*/
onShare?: (instance: ViewTransitionInstance, types: Array<string>) => void;
onShare?: (instance: ViewTransitionInstance, types: Array<string>) => void | (() => void);
/**
* The content of `<ViewTransition>` has changed either due to DOM mutations or because an inner child `<ViewTransition>` has resized.
*/
onUpdate?: (instance: ViewTransitionInstance, types: Array<string>) => void;
onUpdate?: (instance: ViewTransitionInstance, types: Array<string>) => void | (() => void);
ref?: Ref<ViewTransitionInstance> | undefined;
/**
* Combined with {@link className} if this `<ViewTransition>` is being mounted and another instance with the same name is being unmounted elsewhere.
@@ -117,4 +119,11 @@ declare module "." {
export interface FragmentProps {
ref?: Ref<FragmentInstance> | undefined;
}
interface SubmitEvent<T = Element> extends SyntheticEvent<T, NativeSubmitEvent> {
/**
* Only available in react@canary
*/
submitter: HTMLElement | null;
}
}
+39 -2
View File
@@ -106,8 +106,8 @@ declare module "." {
* However, if you wrap these items in a `SuspenseList`, React will not show an item in the list
* until previous items have been displayed (this behavior is adjustable).
*
* @see https://reactjs.org/docs/concurrent-mode-reference.html#suspenselist
* @see https://reactjs.org/docs/concurrent-mode-patterns.html#suspenselist
* @see {@link https://reactjs.org/docs/concurrent-mode-reference.html#suspenselist}
* @see {@link https://reactjs.org/docs/concurrent-mode-patterns.html#suspenselist}
*/
export const unstable_SuspenseList: ExoticComponent<SuspenseListProps>;
@@ -129,6 +129,9 @@ declare module "." {
rangeStart?: number | undefined;
rangeEnd?: number | undefined;
}
export type GestureOptionsRequired = {
[P in keyof GestureOptions]-?: NonNullable<GestureOptions[P]>;
};
/** */
export function unstable_startGestureTransition(
provider: GestureProvider,
@@ -136,6 +139,33 @@ declare module "." {
options?: GestureOptions,
): () => void;
interface ViewTransitionProps {
onGestureEnter?: (
timeline: GestureProvider,
options: GestureOptionsRequired,
instance: ViewTransitionInstance,
types: Array<string>,
) => void | (() => void);
onGestureExit?: (
timeline: GestureProvider,
options: GestureOptionsRequired,
instance: ViewTransitionInstance,
types: Array<string>,
) => void | (() => void);
onGestureShare?: (
timeline: GestureProvider,
options: GestureOptionsRequired,
instance: ViewTransitionInstance,
types: Array<string>,
) => void | (() => void);
onGestureUpdate?: (
timeline: GestureProvider,
options: GestureOptionsRequired,
instance: ViewTransitionInstance,
types: Array<string>,
) => void | (() => void);
}
// @enableSrcObject
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_IMG_SRC_TYPES {
srcObject: Blob;
@@ -144,4 +174,11 @@ declare module "." {
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_MEDIA_SRC_TYPES {
srcObject: Blob | MediaSource | MediaStream;
}
// @enableOptimisticKey
export const optimisticKey: unique symbol;
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_KEY_TYPES {
optimisticKey: typeof optimisticKey;
}
}
+1
View File
@@ -18,6 +18,7 @@ interface KeyboardEvent extends Event {}
interface MouseEvent extends Event {}
interface TouchEvent extends Event {}
interface PointerEvent extends Event {}
interface SubmitEvent extends Event {}
interface ToggleEvent extends Event {}
interface TransitionEvent extends Event {}
interface UIEvent extends Event {}
+74 -29
View File
@@ -16,6 +16,7 @@ type NativeKeyboardEvent = KeyboardEvent;
type NativeMouseEvent = MouseEvent;
type NativeTouchEvent = TouchEvent;
type NativePointerEvent = PointerEvent;
type NativeSubmitEvent = SubmitEvent;
type NativeToggleEvent = ToggleEvent;
type NativeTransitionEvent = TransitionEvent;
type NativeUIEvent = UIEvent;
@@ -225,12 +226,20 @@ declare namespace React {
type ComponentState = any;
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_KEY_TYPES {}
/**
* A value which uniquely identifies a node among items in an array.
*
* @see {@link https://react.dev/learn/rendering-lists#keeping-list-items-in-order-with-key React Docs}
*/
type Key = string | number | bigint;
type Key =
| string
| number
| bigint
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_KEY_TYPES[
keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_KEY_TYPES
];
/**
* @internal The props any component can receive.
@@ -399,7 +408,7 @@ declare namespace React {
*
* Where {@link ReactElement} only represents JSX, `ReactNode` represents everything that can be rendered.
*
* @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/reactnode/ React TypeScript Cheatsheet}
* @see {@link https://react-typescript-cheatsheet.netlify.app/docs/reference/reactnode/ React TypeScript Cheatsheet}
*
* @example
*
@@ -1422,7 +1431,7 @@ declare namespace React {
* instead of this type, as they let you be explicit about whether or not to include
* the `ref` prop.
*
* @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/ React TypeScript Cheatsheet}
* @see {@link https://react-typescript-cheatsheet.netlify.app/docs/reference/ComponentProps React TypeScript Cheatsheet}
*
* @example
*
@@ -1450,7 +1459,7 @@ declare namespace React {
* passed a string, indicating a DOM element (e.g. 'div', 'span', etc.) or the
* type of a React component.
*
* @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/ React TypeScript Cheatsheet}
* @see {@link https://react-typescript-cheatsheet.netlify.app/docs/reference/ComponentProps React TypeScript Cheatsheet}
*
* @example
*
@@ -1500,7 +1509,7 @@ declare namespace React {
* passed a string, indicating a DOM element (e.g. 'div', 'span', etc.) or the
* type of a React component.
*
* @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/ React TypeScript Cheatsheet}
* @see {@link https://react-typescript-cheatsheet.netlify.app/docs/reference/ComponentProps React TypeScript Cheatsheet}
*
* @example
*
@@ -1884,7 +1893,7 @@ declare namespace React {
*
* @param callback A synchronous, void callback that will execute as a single, complete React commit.
*
* @see https://reactjs.org/blog/2019/02/06/react-v16.8.0.html#testing-hooks
* @see {@link https://reactjs.org/blog/2019/02/06/react-v16.8.0.html#testing-hooks}
*/
// NOTES
// - the order of these signatures matters - typescript will check the signatures in source order.
@@ -2065,15 +2074,28 @@ declare namespace React {
target: EventTarget & Target;
}
/**
* @deprecated FormEvent doesn't actually exist.
* You probably meant to use {@link ChangeEvent}, {@link InputEvent}, {@link SubmitEvent}, or just {@link SyntheticEvent} instead
* depending on the event type.
*/
interface FormEvent<T = Element> extends SyntheticEvent<T> {
}
interface InvalidEvent<T = Element> extends SyntheticEvent<T> {
target: EventTarget & T;
}
interface ChangeEvent<T = Element> extends SyntheticEvent<T> {
target: EventTarget & T;
/**
* change events bubble in React so their target is generally unknown.
* Only for form elements we know their target type because form events can't
* be nested.
* This type exists purely to narrow `target` for form elements. It doesn't
* reflect a DOM event. Change events are just fired as standard {@link SyntheticEvent}.
*/
interface ChangeEvent<CurrentTarget = Element, Target = Element> extends SyntheticEvent<CurrentTarget> {
// TODO: This is wrong for change event handlers on arbitrary. Should
// be EventTarget & Target, but kept for backward compatibility until React 20.
target: EventTarget & CurrentTarget;
}
interface InputEvent<T = Element> extends SyntheticEvent<T, NativeInputEvent> {
@@ -2143,6 +2165,13 @@ declare namespace React {
shiftKey: boolean;
}
interface SubmitEvent<T = Element> extends SyntheticEvent<T, NativeSubmitEvent> {
// `submitter` is available in react@canary
// submitter: HTMLElement | null;
// SubmitEvents are always targetted at HTMLFormElements.
target: EventTarget & HTMLFormElement;
}
interface TouchEvent<T = Element> extends UIEvent<T, NativeTouchEvent> {
altKey: boolean;
changedTouches: TouchList;
@@ -2198,11 +2227,19 @@ declare namespace React {
type CompositionEventHandler<T = Element> = EventHandler<CompositionEvent<T>>;
type DragEventHandler<T = Element> = EventHandler<DragEvent<T>>;
type FocusEventHandler<T = Element> = EventHandler<FocusEvent<T>>;
/**
* @deprecated FormEventHandler doesn't actually exist.
* You probably meant to use {@link ChangeEventHandler}, {@link InputEventHandler}, {@link SubmitEventHandler}, or just {@link EventHandler} instead
* depending on the event type.
*/
type FormEventHandler<T = Element> = EventHandler<FormEvent<T>>;
type ChangeEventHandler<T = Element> = EventHandler<ChangeEvent<T>>;
type ChangeEventHandler<CurrentTarget = Element, Target = Element> = EventHandler<
ChangeEvent<CurrentTarget, Target>
>;
type InputEventHandler<T = Element> = EventHandler<InputEvent<T>>;
type KeyboardEventHandler<T = Element> = EventHandler<KeyboardEvent<T>>;
type MouseEventHandler<T = Element> = EventHandler<MouseEvent<T>>;
type SubmitEventHandler<T = Element> = EventHandler<SubmitEvent<T>>;
type TouchEventHandler<T = Element> = EventHandler<TouchEvent<T>>;
type PointerEventHandler<T = Element> = EventHandler<PointerEvent<T>>;
type UIEventHandler<T = Element> = EventHandler<UIEvent<T>>;
@@ -2256,19 +2293,19 @@ declare namespace React {
onBlur?: FocusEventHandler<T> | undefined;
onBlurCapture?: FocusEventHandler<T> | undefined;
// Form Events
onChange?: FormEventHandler<T> | undefined;
onChangeCapture?: FormEventHandler<T> | undefined;
// form related Events
onChange?: ChangeEventHandler<T> | undefined;
onChangeCapture?: ChangeEventHandler<T> | undefined;
onBeforeInput?: InputEventHandler<T> | undefined;
onBeforeInputCapture?: FormEventHandler<T> | undefined;
onInput?: FormEventHandler<T> | undefined;
onInputCapture?: FormEventHandler<T> | undefined;
onReset?: FormEventHandler<T> | undefined;
onResetCapture?: FormEventHandler<T> | undefined;
onSubmit?: FormEventHandler<T> | undefined;
onSubmitCapture?: FormEventHandler<T> | undefined;
onInvalid?: FormEventHandler<T> | undefined;
onInvalidCapture?: FormEventHandler<T> | undefined;
onBeforeInputCapture?: InputEventHandler<T> | undefined;
onInput?: InputEventHandler<T> | undefined;
onInputCapture?: InputEventHandler<T> | undefined;
onReset?: ReactEventHandler<T> | undefined;
onResetCapture?: ReactEventHandler<T> | undefined;
onSubmit?: SubmitEventHandler<T> | undefined;
onSubmitCapture?: SubmitEventHandler<T> | undefined;
onInvalid?: ReactEventHandler<T> | undefined;
onInvalidCapture?: ReactEventHandler<T> | undefined;
// Image Events
onLoad?: ReactEventHandler<T> | undefined;
@@ -2812,7 +2849,7 @@ declare namespace React {
// Living Standard
/**
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert}
*/
inert?: boolean | undefined;
/**
@@ -3129,7 +3166,7 @@ declare namespace React {
alt?: string | undefined;
crossOrigin?: CrossOrigin;
decoding?: "async" | "auto" | "sync" | undefined;
fetchPriority?: "high" | "low" | "auto";
fetchPriority?: "high" | "low" | "auto" | undefined;
height?: number | string | undefined;
loading?: "eager" | "lazy" | undefined;
referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
@@ -3275,7 +3312,9 @@ declare namespace React {
value?: string | readonly string[] | number | undefined;
width?: number | string | undefined;
onChange?: ChangeEventHandler<T> | undefined;
// No other element dispatching change events can be nested in a <input>
// so we know the target will be a HTMLInputElement.
onChange?: ChangeEventHandler<T, HTMLInputElement> | undefined;
}
interface KeygenHTMLAttributes<T> extends HTMLAttributes<T> {
@@ -3300,7 +3339,7 @@ declare namespace React {
as?: string | undefined;
blocking?: "render" | (string & {}) | undefined;
crossOrigin?: CrossOrigin;
fetchPriority?: "high" | "low" | "auto";
fetchPriority?: "high" | "low" | "auto" | undefined;
href?: string | undefined;
hrefLang?: string | undefined;
integrity?: string | undefined;
@@ -3440,7 +3479,9 @@ declare namespace React {
required?: boolean | undefined;
size?: number | undefined;
value?: string | readonly string[] | number | undefined;
onChange?: ChangeEventHandler<T> | undefined;
// No other element dispatching change events can be nested in a <select>
// so we know the target will be a HTMLSelectElement.
onChange?: ChangeEventHandler<T, HTMLSelectElement> | undefined;
}
interface SourceHTMLAttributes<T> extends HTMLAttributes<T> {
@@ -3492,7 +3533,9 @@ declare namespace React {
value?: string | readonly string[] | number | undefined;
wrap?: string | undefined;
onChange?: ChangeEventHandler<T> | undefined;
// No other element dispatching change events can be nested in a <textarea>
// so we know the target will be a HTMLTextAreaElement.
onChange?: ChangeEventHandler<T, HTMLTextAreaElement> | undefined;
}
interface TdHTMLAttributes<T> extends HTMLAttributes<T> {
@@ -3564,6 +3607,9 @@ declare namespace React {
method?: string | undefined;
min?: number | string | undefined;
name?: string | undefined;
nonce?: string | undefined;
part?: string | undefined;
slot?: string | undefined;
style?: CSSProperties | undefined;
target?: string | undefined;
type?: string | undefined;
@@ -4083,7 +4129,6 @@ declare namespace React {
componentStack?: string | null;
}
// Keep in sync with JSX namespace in ./jsx-runtime.d.ts and ./jsx-dev-runtime.d.ts
namespace JSX {
// We don't just alias React.ElementType because React.ElementType
// historically does more than we need it to.
+1 -13
View File
@@ -1,17 +1,5 @@
import * as React from "./";
export { Fragment } from "./";
export namespace JSX {
type ElementType = React.JSX.ElementType;
interface Element extends React.JSX.Element {}
interface ElementClass extends React.JSX.ElementClass {}
interface ElementAttributesProperty extends React.JSX.ElementAttributesProperty {}
interface ElementChildrenAttribute extends React.JSX.ElementChildrenAttribute {}
type LibraryManagedAttributes<C, P> = React.JSX.LibraryManagedAttributes<C, P>;
interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {}
interface IntrinsicClassAttributes<T> extends React.JSX.IntrinsicClassAttributes<T> {}
interface IntrinsicElements extends React.JSX.IntrinsicElements {}
}
export { Fragment, JSX } from "./";
export interface JSXSource {
/**
+1 -13
View File
@@ -1,17 +1,5 @@
import * as React from "./";
export { Fragment } from "./";
export namespace JSX {
type ElementType = React.JSX.ElementType;
interface Element extends React.JSX.Element {}
interface ElementClass extends React.JSX.ElementClass {}
interface ElementAttributesProperty extends React.JSX.ElementAttributesProperty {}
interface ElementChildrenAttribute extends React.JSX.ElementChildrenAttribute {}
type LibraryManagedAttributes<C, P> = React.JSX.LibraryManagedAttributes<C, P>;
interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {}
interface IntrinsicClassAttributes<T> extends React.JSX.IntrinsicClassAttributes<T> {}
interface IntrinsicElements extends React.JSX.IntrinsicElements {}
}
export { Fragment, JSX } from "./";
/**
* Create a React element.
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@types/react",
"version": "19.2.7",
"version": "19.2.17",
"description": "TypeScript definitions for react",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react",
"license": "MIT",
@@ -205,6 +205,6 @@
"csstype": "^3.2.2"
},
"peerDependencies": {},
"typesPublisherContentHash": "fd69ea47f2fc8e9d139677eb6bcca67ee4b3ac279ce5ceb2e6e23ce8403c356d",
"typeScriptVersion": "5.2"
"typesPublisherContentHash": "f6d087e89b6a483b6ea2519d4f16498227ceb3260f6a6414fed750badc869721",
"typeScriptVersion": "5.3"
}
+13 -4
View File
@@ -30,6 +30,8 @@ export {};
declare const UNDEFINED_VOID_ONLY: unique symbol;
type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
type NativeSubmitEvent = SubmitEvent;
declare module "." {
export function unstable_useCacheRefresh(): () => void;
@@ -71,19 +73,19 @@ declare module "." {
/**
* The `<ViewTransition>` or its parent Component is mounted and there's no other `<ViewTransition>` with the same name being deleted.
*/
onEnter?: (instance: ViewTransitionInstance, types: Array<string>) => void;
onEnter?: (instance: ViewTransitionInstance, types: Array<string>) => void | (() => void);
/**
* The `<ViewTransition>` or its parent Component is unmounted and there's no other `<ViewTransition>` with the same name being deleted.
*/
onExit?: (instance: ViewTransitionInstance, types: Array<string>) => void;
onExit?: (instance: ViewTransitionInstance, types: Array<string>) => void | (() => void);
/**
* This `<ViewTransition>` is being mounted and another `<ViewTransition>` instance with the same name is being unmounted elsewhere.
*/
onShare?: (instance: ViewTransitionInstance, types: Array<string>) => void;
onShare?: (instance: ViewTransitionInstance, types: Array<string>) => void | (() => void);
/**
* The content of `<ViewTransition>` has changed either due to DOM mutations or because an inner child `<ViewTransition>` has resized.
*/
onUpdate?: (instance: ViewTransitionInstance, types: Array<string>) => void;
onUpdate?: (instance: ViewTransitionInstance, types: Array<string>) => void | (() => void);
ref?: Ref<ViewTransitionInstance> | undefined;
/**
* Combined with {@link className} if this `<ViewTransition>` is being mounted and another instance with the same name is being unmounted elsewhere.
@@ -117,4 +119,11 @@ declare module "." {
export interface FragmentProps {
ref?: Ref<FragmentInstance> | undefined;
}
interface SubmitEvent<T = Element> extends SyntheticEvent<T, NativeSubmitEvent> {
/**
* Only available in react@canary
*/
submitter: HTMLElement | null;
}
}
+39 -2
View File
@@ -106,8 +106,8 @@ declare module "." {
* However, if you wrap these items in a `SuspenseList`, React will not show an item in the list
* until previous items have been displayed (this behavior is adjustable).
*
* @see https://reactjs.org/docs/concurrent-mode-reference.html#suspenselist
* @see https://reactjs.org/docs/concurrent-mode-patterns.html#suspenselist
* @see {@link https://reactjs.org/docs/concurrent-mode-reference.html#suspenselist}
* @see {@link https://reactjs.org/docs/concurrent-mode-patterns.html#suspenselist}
*/
export const unstable_SuspenseList: ExoticComponent<SuspenseListProps>;
@@ -129,6 +129,9 @@ declare module "." {
rangeStart?: number | undefined;
rangeEnd?: number | undefined;
}
export type GestureOptionsRequired = {
[P in keyof GestureOptions]-?: NonNullable<GestureOptions[P]>;
};
/** */
export function unstable_startGestureTransition(
provider: GestureProvider,
@@ -136,6 +139,33 @@ declare module "." {
options?: GestureOptions,
): () => void;
interface ViewTransitionProps {
onGestureEnter?: (
timeline: GestureProvider,
options: GestureOptionsRequired,
instance: ViewTransitionInstance,
types: Array<string>,
) => void | (() => void);
onGestureExit?: (
timeline: GestureProvider,
options: GestureOptionsRequired,
instance: ViewTransitionInstance,
types: Array<string>,
) => void | (() => void);
onGestureShare?: (
timeline: GestureProvider,
options: GestureOptionsRequired,
instance: ViewTransitionInstance,
types: Array<string>,
) => void | (() => void);
onGestureUpdate?: (
timeline: GestureProvider,
options: GestureOptionsRequired,
instance: ViewTransitionInstance,
types: Array<string>,
) => void | (() => void);
}
// @enableSrcObject
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_IMG_SRC_TYPES {
srcObject: Blob;
@@ -144,4 +174,11 @@ declare module "." {
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_MEDIA_SRC_TYPES {
srcObject: Blob | MediaSource | MediaStream;
}
// @enableOptimisticKey
export const optimisticKey: unique symbol;
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_KEY_TYPES {
optimisticKey: typeof optimisticKey;
}
}
+1
View File
@@ -18,6 +18,7 @@ interface KeyboardEvent extends Event {}
interface MouseEvent extends Event {}
interface TouchEvent extends Event {}
interface PointerEvent extends Event {}
interface SubmitEvent extends Event {}
interface ToggleEvent extends Event {}
interface TransitionEvent extends Event {}
interface UIEvent extends Event {}
+74 -29
View File
@@ -16,6 +16,7 @@ type NativeKeyboardEvent = KeyboardEvent;
type NativeMouseEvent = MouseEvent;
type NativeTouchEvent = TouchEvent;
type NativePointerEvent = PointerEvent;
type NativeSubmitEvent = SubmitEvent;
type NativeToggleEvent = ToggleEvent;
type NativeTransitionEvent = TransitionEvent;
type NativeUIEvent = UIEvent;
@@ -225,12 +226,20 @@ declare namespace React {
type ComponentState = any;
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_KEY_TYPES {}
/**
* A value which uniquely identifies a node among items in an array.
*
* @see {@link https://react.dev/learn/rendering-lists#keeping-list-items-in-order-with-key React Docs}
*/
type Key = string | number | bigint;
type Key =
| string
| number
| bigint
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_KEY_TYPES[
keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_KEY_TYPES
];
/**
* @internal The props any component can receive.
@@ -400,7 +409,7 @@ declare namespace React {
*
* Where {@link ReactElement} only represents JSX, `ReactNode` represents everything that can be rendered.
*
* @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/reactnode/ React TypeScript Cheatsheet}
* @see {@link https://react-typescript-cheatsheet.netlify.app/docs/reference/reactnode/ React TypeScript Cheatsheet}
*
* @example
*
@@ -1421,7 +1430,7 @@ declare namespace React {
* instead of this type, as they let you be explicit about whether or not to include
* the `ref` prop.
*
* @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/ React TypeScript Cheatsheet}
* @see {@link https://react-typescript-cheatsheet.netlify.app/docs/reference/ComponentProps React TypeScript Cheatsheet}
*
* @example
*
@@ -1449,7 +1458,7 @@ declare namespace React {
* passed a string, indicating a DOM element (e.g. 'div', 'span', etc.) or the
* type of a React component.
*
* @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/ React TypeScript Cheatsheet}
* @see {@link https://react-typescript-cheatsheet.netlify.app/docs/reference/ComponentProps React TypeScript Cheatsheet}
*
* @example
*
@@ -1499,7 +1508,7 @@ declare namespace React {
* passed a string, indicating a DOM element (e.g. 'div', 'span', etc.) or the
* type of a React component.
*
* @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/ React TypeScript Cheatsheet}
* @see {@link https://react-typescript-cheatsheet.netlify.app/docs/reference/ComponentProps React TypeScript Cheatsheet}
*
* @example
*
@@ -1883,7 +1892,7 @@ declare namespace React {
*
* @param callback A synchronous, void callback that will execute as a single, complete React commit.
*
* @see https://reactjs.org/blog/2019/02/06/react-v16.8.0.html#testing-hooks
* @see {@link https://reactjs.org/blog/2019/02/06/react-v16.8.0.html#testing-hooks}
*/
// NOTES
// - the order of these signatures matters - typescript will check the signatures in source order.
@@ -2064,15 +2073,28 @@ declare namespace React {
target: EventTarget & Target;
}
/**
* @deprecated FormEvent doesn't actually exist.
* You probably meant to use {@link ChangeEvent}, {@link InputEvent}, {@link SubmitEvent}, or just {@link SyntheticEvent} instead
* depending on the event type.
*/
interface FormEvent<T = Element> extends SyntheticEvent<T> {
}
interface InvalidEvent<T = Element> extends SyntheticEvent<T> {
target: EventTarget & T;
}
interface ChangeEvent<T = Element> extends SyntheticEvent<T> {
target: EventTarget & T;
/**
* change events bubble in React so their target is generally unknown.
* Only for form elements we know their target type because form events can't
* be nested.
* This type exists purely to narrow `target` for form elements. It doesn't
* reflect a DOM event. Change events are just fired as standard {@link SyntheticEvent}.
*/
interface ChangeEvent<CurrentTarget = Element, Target = Element> extends SyntheticEvent<CurrentTarget> {
// TODO: This is wrong for change event handlers on arbitrary. Should
// be EventTarget & Target, but kept for backward compatibility until React 20.
target: EventTarget & CurrentTarget;
}
interface InputEvent<T = Element> extends SyntheticEvent<T, NativeInputEvent> {
@@ -2142,6 +2164,13 @@ declare namespace React {
shiftKey: boolean;
}
interface SubmitEvent<T = Element> extends SyntheticEvent<T, NativeSubmitEvent> {
// `submitter` is available in react@canary
// submitter: HTMLElement | null;
// SubmitEvents are always targetted at HTMLFormElements.
target: EventTarget & HTMLFormElement;
}
interface TouchEvent<T = Element> extends UIEvent<T, NativeTouchEvent> {
altKey: boolean;
changedTouches: TouchList;
@@ -2197,11 +2226,19 @@ declare namespace React {
type CompositionEventHandler<T = Element> = EventHandler<CompositionEvent<T>>;
type DragEventHandler<T = Element> = EventHandler<DragEvent<T>>;
type FocusEventHandler<T = Element> = EventHandler<FocusEvent<T>>;
/**
* @deprecated FormEventHandler doesn't actually exist.
* You probably meant to use {@link ChangeEventHandler}, {@link InputEventHandler}, {@link SubmitEventHandler}, or just {@link EventHandler} instead
* depending on the event type.
*/
type FormEventHandler<T = Element> = EventHandler<FormEvent<T>>;
type ChangeEventHandler<T = Element> = EventHandler<ChangeEvent<T>>;
type ChangeEventHandler<CurrentTarget = Element, Target = Element> = EventHandler<
ChangeEvent<CurrentTarget, Target>
>;
type InputEventHandler<T = Element> = EventHandler<InputEvent<T>>;
type KeyboardEventHandler<T = Element> = EventHandler<KeyboardEvent<T>>;
type MouseEventHandler<T = Element> = EventHandler<MouseEvent<T>>;
type SubmitEventHandler<T = Element> = EventHandler<SubmitEvent<T>>;
type TouchEventHandler<T = Element> = EventHandler<TouchEvent<T>>;
type PointerEventHandler<T = Element> = EventHandler<PointerEvent<T>>;
type UIEventHandler<T = Element> = EventHandler<UIEvent<T>>;
@@ -2255,19 +2292,19 @@ declare namespace React {
onBlur?: FocusEventHandler<T> | undefined;
onBlurCapture?: FocusEventHandler<T> | undefined;
// Form Events
onChange?: FormEventHandler<T> | undefined;
onChangeCapture?: FormEventHandler<T> | undefined;
// form related Events
onChange?: ChangeEventHandler<T> | undefined;
onChangeCapture?: ChangeEventHandler<T> | undefined;
onBeforeInput?: InputEventHandler<T> | undefined;
onBeforeInputCapture?: FormEventHandler<T> | undefined;
onInput?: FormEventHandler<T> | undefined;
onInputCapture?: FormEventHandler<T> | undefined;
onReset?: FormEventHandler<T> | undefined;
onResetCapture?: FormEventHandler<T> | undefined;
onSubmit?: FormEventHandler<T> | undefined;
onSubmitCapture?: FormEventHandler<T> | undefined;
onInvalid?: FormEventHandler<T> | undefined;
onInvalidCapture?: FormEventHandler<T> | undefined;
onBeforeInputCapture?: InputEventHandler<T> | undefined;
onInput?: InputEventHandler<T> | undefined;
onInputCapture?: InputEventHandler<T> | undefined;
onReset?: ReactEventHandler<T> | undefined;
onResetCapture?: ReactEventHandler<T> | undefined;
onSubmit?: SubmitEventHandler<T> | undefined;
onSubmitCapture?: SubmitEventHandler<T> | undefined;
onInvalid?: ReactEventHandler<T> | undefined;
onInvalidCapture?: ReactEventHandler<T> | undefined;
// Image Events
onLoad?: ReactEventHandler<T> | undefined;
@@ -2811,7 +2848,7 @@ declare namespace React {
// Living Standard
/**
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert}
*/
inert?: boolean | undefined;
/**
@@ -3128,7 +3165,7 @@ declare namespace React {
alt?: string | undefined;
crossOrigin?: CrossOrigin;
decoding?: "async" | "auto" | "sync" | undefined;
fetchPriority?: "high" | "low" | "auto";
fetchPriority?: "high" | "low" | "auto" | undefined;
height?: number | string | undefined;
loading?: "eager" | "lazy" | undefined;
referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
@@ -3274,7 +3311,9 @@ declare namespace React {
value?: string | readonly string[] | number | undefined;
width?: number | string | undefined;
onChange?: ChangeEventHandler<T> | undefined;
// No other element dispatching change events can be nested in a <input>
// so we know the target will be a HTMLInputElement.
onChange?: ChangeEventHandler<T, HTMLInputElement> | undefined;
}
interface KeygenHTMLAttributes<T> extends HTMLAttributes<T> {
@@ -3299,7 +3338,7 @@ declare namespace React {
as?: string | undefined;
blocking?: "render" | (string & {}) | undefined;
crossOrigin?: CrossOrigin;
fetchPriority?: "high" | "low" | "auto";
fetchPriority?: "high" | "low" | "auto" | undefined;
href?: string | undefined;
hrefLang?: string | undefined;
integrity?: string | undefined;
@@ -3439,7 +3478,9 @@ declare namespace React {
required?: boolean | undefined;
size?: number | undefined;
value?: string | readonly string[] | number | undefined;
onChange?: ChangeEventHandler<T> | undefined;
// No other element dispatching change events can be nested in a <select>
// so we know the target will be a HTMLSelectElement.
onChange?: ChangeEventHandler<T, HTMLSelectElement> | undefined;
}
interface SourceHTMLAttributes<T> extends HTMLAttributes<T> {
@@ -3491,7 +3532,9 @@ declare namespace React {
value?: string | readonly string[] | number | undefined;
wrap?: string | undefined;
onChange?: ChangeEventHandler<T> | undefined;
// No other element dispatching change events can be nested in a <textarea>
// so we know the target will be a HTMLTextAreaElement.
onChange?: ChangeEventHandler<T, HTMLTextAreaElement> | undefined;
}
interface TdHTMLAttributes<T> extends HTMLAttributes<T> {
@@ -3563,6 +3606,9 @@ declare namespace React {
method?: string | undefined;
min?: number | string | undefined;
name?: string | undefined;
nonce?: string | undefined;
part?: string | undefined;
slot?: string | undefined;
style?: CSSProperties | undefined;
target?: string | undefined;
type?: string | undefined;
@@ -4082,7 +4128,6 @@ declare namespace React {
componentStack?: string | null;
}
// Keep in sync with JSX namespace in ./jsx-runtime.d.ts and ./jsx-dev-runtime.d.ts
namespace JSX {
interface Element extends React.ReactElement<any, any> {}
interface ElementClass extends React.Component<any> {
+1 -12
View File
@@ -1,16 +1,5 @@
import * as React from "./";
export { Fragment } from "./";
export namespace JSX {
interface Element extends React.JSX.Element {}
interface ElementClass extends React.JSX.ElementClass {}
interface ElementAttributesProperty extends React.JSX.ElementAttributesProperty {}
interface ElementChildrenAttribute extends React.JSX.ElementChildrenAttribute {}
type LibraryManagedAttributes<C, P> = React.JSX.LibraryManagedAttributes<C, P>;
interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {}
interface IntrinsicClassAttributes<T> extends React.JSX.IntrinsicClassAttributes<T> {}
interface IntrinsicElements extends React.JSX.IntrinsicElements {}
}
export { Fragment, JSX } from "./";
export interface JSXSource {
/**
+1 -12
View File
@@ -1,16 +1,5 @@
import * as React from "./";
export { Fragment } from "./";
export namespace JSX {
interface Element extends React.JSX.Element {}
interface ElementClass extends React.JSX.ElementClass {}
interface ElementAttributesProperty extends React.JSX.ElementAttributesProperty {}
interface ElementChildrenAttribute extends React.JSX.ElementChildrenAttribute {}
type LibraryManagedAttributes<C, P> = React.JSX.LibraryManagedAttributes<C, P>;
interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {}
interface IntrinsicClassAttributes<T> extends React.JSX.IntrinsicClassAttributes<T> {}
interface IntrinsicElements extends React.JSX.IntrinsicElements {}
}
export { Fragment, JSX } from "./";
/**
* Create a React element.