@types/node 24.3.2 → 24.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- node/README.md +1 -1
- node/buffer.d.ts +1 -1
- node/child_process.d.ts +1 -1
- node/crypto.d.ts +44 -10
- node/fs/promises.d.ts +22 -0
- node/fs.d.ts +33 -0
- node/http.d.ts +1 -1
- node/module.d.ts +1 -0
- node/package.json +3 -3
- node/sqlite.d.ts +27 -0
- node/vm.d.ts +73 -10
- node/wasi.d.ts +21 -0
- node/worker_threads.d.ts +18 -0
node/README.md
CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
9
9
|
|
10
10
|
### Additional Details
|
11
|
-
* Last updated:
|
11
|
+
* Last updated: Sun, 14 Sep 2025 10:33:22 GMT
|
12
12
|
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
13
13
|
|
14
14
|
# Credits
|
node/buffer.d.ts
CHANGED
@@ -139,7 +139,7 @@ declare module "buffer" {
|
|
139
139
|
type?: string | undefined;
|
140
140
|
}
|
141
141
|
/**
|
142
|
-
* A
|
142
|
+
* A `Blob` encapsulates immutable, raw data that can be safely shared across
|
143
143
|
* multiple worker threads.
|
144
144
|
* @since v15.7.0, v14.18.0
|
145
145
|
*/
|
node/child_process.d.ts
CHANGED
@@ -24,7 +24,7 @@
|
|
24
24
|
* the parent Node.js process and the spawned subprocess. These pipes have
|
25
25
|
* limited (and platform-specific) capacity. If the subprocess writes to
|
26
26
|
* stdout in excess of that limit without the output being captured, the
|
27
|
-
* subprocess blocks waiting for the pipe buffer to accept more data. This is
|
27
|
+
* subprocess blocks, waiting for the pipe buffer to accept more data. This is
|
28
28
|
* identical to the behavior of pipes in the shell. Use the `{ stdio: 'ignore' }` option if the output will not be consumed.
|
29
29
|
*
|
30
30
|
* The command lookup is performed using the `options.env.PATH` environment
|
node/crypto.d.ts
CHANGED
@@ -3363,11 +3363,36 @@ declare module "crypto" {
|
|
3363
3363
|
options: { privateKey: KeyObject; publicKey: KeyObject },
|
3364
3364
|
callback: (err: Error | null, secret: Buffer) => void,
|
3365
3365
|
): void;
|
3366
|
+
interface OneShotDigestOptions {
|
3367
|
+
/**
|
3368
|
+
* Encoding used to encode the returned digest.
|
3369
|
+
* @default 'hex'
|
3370
|
+
*/
|
3371
|
+
outputEncoding?: BinaryToTextEncoding | "buffer" | undefined;
|
3372
|
+
/**
|
3373
|
+
* For XOF hash functions such as 'shake256', the outputLength option
|
3374
|
+
* can be used to specify the desired output length in bytes.
|
3375
|
+
*/
|
3376
|
+
outputLength?: number | undefined;
|
3377
|
+
}
|
3378
|
+
interface OneShotDigestOptionsWithStringEncoding extends OneShotDigestOptions {
|
3379
|
+
outputEncoding?: BinaryToTextEncoding | undefined;
|
3380
|
+
}
|
3381
|
+
interface OneShotDigestOptionsWithBufferEncoding extends OneShotDigestOptions {
|
3382
|
+
outputEncoding: "buffer";
|
3383
|
+
}
|
3366
3384
|
/**
|
3367
|
-
* A utility for creating one-shot hash digests of data. It can be faster than
|
3368
|
-
*
|
3369
|
-
*
|
3370
|
-
*
|
3385
|
+
* A utility for creating one-shot hash digests of data. It can be faster than
|
3386
|
+
* the object-based `crypto.createHash()` when hashing a smaller amount of data
|
3387
|
+
* (<= 5MB) that's readily available. If the data can be big or if it is streamed,
|
3388
|
+
* it's still recommended to use `crypto.createHash()` instead.
|
3389
|
+
*
|
3390
|
+
* The `algorithm` is dependent on the available algorithms supported by the
|
3391
|
+
* version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc.
|
3392
|
+
* On recent releases of OpenSSL, `openssl list -digest-algorithms` will
|
3393
|
+
* display the available digest algorithms.
|
3394
|
+
*
|
3395
|
+
* If `options` is a string, then it specifies the `outputEncoding`.
|
3371
3396
|
*
|
3372
3397
|
* Example:
|
3373
3398
|
*
|
@@ -3387,16 +3412,25 @@ declare module "crypto" {
|
|
3387
3412
|
* console.log(crypto.hash('sha1', Buffer.from(base64, 'base64'), 'buffer'));
|
3388
3413
|
* ```
|
3389
3414
|
* @since v21.7.0, v20.12.0
|
3390
|
-
* @param data When `data` is a string, it will be encoded as UTF-8 before being hashed. If a different
|
3391
|
-
*
|
3392
|
-
*
|
3415
|
+
* @param data When `data` is a string, it will be encoded as UTF-8 before being hashed. If a different
|
3416
|
+
* input encoding is desired for a string input, user could encode the string
|
3417
|
+
* into a `TypedArray` using either `TextEncoder` or `Buffer.from()` and passing
|
3418
|
+
* the encoded `TypedArray` into this API instead.
|
3393
3419
|
*/
|
3394
|
-
function hash(algorithm: string, data: BinaryLike, outputEncoding?: BinaryToTextEncoding): string;
|
3395
|
-
function hash(algorithm: string, data: BinaryLike, outputEncoding: "buffer"): Buffer;
|
3396
3420
|
function hash(
|
3397
3421
|
algorithm: string,
|
3398
3422
|
data: BinaryLike,
|
3399
|
-
|
3423
|
+
options?: OneShotDigestOptionsWithStringEncoding | BinaryToTextEncoding,
|
3424
|
+
): string;
|
3425
|
+
function hash(
|
3426
|
+
algorithm: string,
|
3427
|
+
data: BinaryLike,
|
3428
|
+
options: OneShotDigestOptionsWithBufferEncoding | "buffer",
|
3429
|
+
): Buffer;
|
3430
|
+
function hash(
|
3431
|
+
algorithm: string,
|
3432
|
+
data: BinaryLike,
|
3433
|
+
options: OneShotDigestOptions | BinaryToTextEncoding | "buffer",
|
3400
3434
|
): string | Buffer;
|
3401
3435
|
type CipherMode = "cbc" | "ccm" | "cfb" | "ctr" | "ecb" | "gcm" | "ocb" | "ofb" | "stream" | "wrap" | "xts";
|
3402
3436
|
interface CipherInfoOptions {
|
node/fs/promises.d.ts
CHANGED
@@ -20,6 +20,8 @@ declare module "fs/promises" {
|
|
20
20
|
CopyOptions,
|
21
21
|
Dir,
|
22
22
|
Dirent,
|
23
|
+
DisposableTempDir,
|
24
|
+
EncodingOption,
|
23
25
|
GlobOptions,
|
24
26
|
GlobOptionsWithFileTypes,
|
25
27
|
GlobOptionsWithoutFileTypes,
|
@@ -961,6 +963,26 @@ declare module "fs/promises" {
|
|
961
963
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
962
964
|
*/
|
963
965
|
function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string | Buffer>;
|
966
|
+
/**
|
967
|
+
* The resulting Promise holds an async-disposable object whose `path` property
|
968
|
+
* holds the created directory path. When the object is disposed, the directory
|
969
|
+
* and its contents will be removed asynchronously if it still exists. If the
|
970
|
+
* directory cannot be deleted, disposal will throw an error. The object has an
|
971
|
+
* async `remove()` method which will perform the same task.
|
972
|
+
*
|
973
|
+
* Both this function and the disposal function on the resulting object are
|
974
|
+
* async, so it should be used with `await` + `await using` as in
|
975
|
+
* `await using dir = await fsPromises.mkdtempDisposable('prefix')`.
|
976
|
+
*
|
977
|
+
* <!-- TODO: link MDN docs for disposables once https://github.com/mdn/content/pull/38027 lands -->
|
978
|
+
*
|
979
|
+
* For detailed information, see the documentation of `fsPromises.mkdtemp()`.
|
980
|
+
*
|
981
|
+
* The optional `options` argument can be a string specifying an encoding, or an
|
982
|
+
* object with an `encoding` property specifying the character encoding to use.
|
983
|
+
* @since v24.4.0
|
984
|
+
*/
|
985
|
+
function mkdtempDisposable(prefix: PathLike, options?: EncodingOption): Promise<DisposableTempDir>;
|
964
986
|
/**
|
965
987
|
* Asynchronously writes data to a file, replacing the file if it already exists. `data` can be a string, a buffer, an
|
966
988
|
* [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface), or an
|
node/fs.d.ts
CHANGED
@@ -1966,6 +1966,39 @@ declare module "fs" {
|
|
1966
1966
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
1967
1967
|
*/
|
1968
1968
|
export function mkdtempSync(prefix: string, options?: EncodingOption): string | Buffer;
|
1969
|
+
export interface DisposableTempDir extends AsyncDisposable {
|
1970
|
+
/**
|
1971
|
+
* The path of the created directory.
|
1972
|
+
*/
|
1973
|
+
path: string;
|
1974
|
+
/**
|
1975
|
+
* A function which removes the created directory.
|
1976
|
+
*/
|
1977
|
+
remove(): Promise<void>;
|
1978
|
+
/**
|
1979
|
+
* The same as `remove`.
|
1980
|
+
*/
|
1981
|
+
[Symbol.asyncDispose](): Promise<void>;
|
1982
|
+
}
|
1983
|
+
/**
|
1984
|
+
* Returns a disposable object whose `path` property holds the created directory
|
1985
|
+
* path. When the object is disposed, the directory and its contents will be
|
1986
|
+
* removed if it still exists. If the directory cannot be deleted, disposal will
|
1987
|
+
* throw an error. The object has a `remove()` method which will perform the same
|
1988
|
+
* task.
|
1989
|
+
*
|
1990
|
+
* <!-- TODO: link MDN docs for disposables once https://github.com/mdn/content/pull/38027 lands -->
|
1991
|
+
*
|
1992
|
+
* For detailed information, see the documentation of `fs.mkdtemp()`.
|
1993
|
+
*
|
1994
|
+
* There is no callback-based version of this API because it is designed for use
|
1995
|
+
* with the `using` syntax.
|
1996
|
+
*
|
1997
|
+
* The optional `options` argument can be a string specifying an encoding, or an
|
1998
|
+
* object with an `encoding` property specifying the character encoding to use.
|
1999
|
+
* @since v24.4.0
|
2000
|
+
*/
|
2001
|
+
export function mkdtempDisposableSync(prefix: string, options?: EncodingOption): DisposableTempDir;
|
1969
2002
|
/**
|
1970
2003
|
* Reads the contents of a directory. The callback gets two arguments `(err, files)` where `files` is an array of the names of the files in the directory excluding `'.'` and `'..'`.
|
1971
2004
|
*
|
node/http.d.ts
CHANGED
@@ -2028,7 +2028,7 @@ declare module "http" {
|
|
2028
2028
|
*/
|
2029
2029
|
const maxHeaderSize: number;
|
2030
2030
|
/**
|
2031
|
-
* A browser-compatible implementation of
|
2031
|
+
* A browser-compatible implementation of `WebSocket`.
|
2032
2032
|
* @since v22.5.0
|
2033
2033
|
*/
|
2034
2034
|
const WebSocket: typeof import("undici-types").WebSocket;
|
node/module.d.ts
CHANGED
node/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/node",
|
3
|
-
"version": "24.
|
3
|
+
"version": "24.4.0",
|
4
4
|
"description": "TypeScript definitions for node",
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
6
6
|
"license": "MIT",
|
@@ -147,9 +147,9 @@
|
|
147
147
|
},
|
148
148
|
"scripts": {},
|
149
149
|
"dependencies": {
|
150
|
-
"undici-types": "~7.
|
150
|
+
"undici-types": "~7.11.0"
|
151
151
|
},
|
152
152
|
"peerDependencies": {},
|
153
|
-
"typesPublisherContentHash": "
|
153
|
+
"typesPublisherContentHash": "fdbd3633b95006b69d1e43664ff9e3d7f2b3679ec29a1a4db03450cfe21d96ef",
|
154
154
|
"typeScriptVersion": "5.2"
|
155
155
|
}
|
node/sqlite.d.ts
CHANGED
@@ -97,6 +97,33 @@ declare module "node:sqlite" {
|
|
97
97
|
* @default 0
|
98
98
|
*/
|
99
99
|
timeout?: number | undefined;
|
100
|
+
/**
|
101
|
+
* If `true`, integer fields are read as JavaScript `BigInt` values. If `false`,
|
102
|
+
* integer fields are read as JavaScript numbers.
|
103
|
+
* @since v24.4.0
|
104
|
+
* @default false
|
105
|
+
*/
|
106
|
+
readBigInts?: boolean | undefined;
|
107
|
+
/**
|
108
|
+
* If `true`, query results are returned as arrays instead of objects.
|
109
|
+
* @since v24.4.0
|
110
|
+
* @default false
|
111
|
+
*/
|
112
|
+
returnArrays?: boolean | undefined;
|
113
|
+
/**
|
114
|
+
* If `true`, allows binding named parameters without the prefix
|
115
|
+
* character (e.g., `foo` instead of `:foo`).
|
116
|
+
* @since v24.4.40
|
117
|
+
* @default true
|
118
|
+
*/
|
119
|
+
allowBareNamedParameters?: boolean | undefined;
|
120
|
+
/**
|
121
|
+
* If `true`, unknown named parameters are ignored when binding.
|
122
|
+
* If `false`, an exception is thrown for unknown named parameters.
|
123
|
+
* @since v24.4.40
|
124
|
+
* @default false
|
125
|
+
*/
|
126
|
+
allowUnknownNamedParameters?: boolean | undefined;
|
100
127
|
}
|
101
128
|
interface CreateSessionOptions {
|
102
129
|
/**
|
node/vm.d.ts
CHANGED
@@ -37,7 +37,7 @@
|
|
37
37
|
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/vm.js)
|
38
38
|
*/
|
39
39
|
declare module "vm" {
|
40
|
-
import { ImportAttributes } from "node:module";
|
40
|
+
import { ImportAttributes, ImportPhase } from "node:module";
|
41
41
|
interface Context extends NodeJS.Dict<any> {}
|
42
42
|
interface BaseOptions {
|
43
43
|
/**
|
@@ -60,7 +60,7 @@ declare module "vm" {
|
|
60
60
|
specifier: string,
|
61
61
|
referrer: T,
|
62
62
|
importAttributes: ImportAttributes,
|
63
|
-
phase:
|
63
|
+
phase: ImportPhase,
|
64
64
|
) => Module | Promise<Module>;
|
65
65
|
interface ScriptOptions extends BaseOptions {
|
66
66
|
/**
|
@@ -791,14 +791,6 @@ declare module "vm" {
|
|
791
791
|
* @experimental
|
792
792
|
*/
|
793
793
|
class Module {
|
794
|
-
/**
|
795
|
-
* The specifiers of all dependencies of this module. The returned array is frozen
|
796
|
-
* to disallow any changes to it.
|
797
|
-
*
|
798
|
-
* Corresponds to the `[[RequestedModules]]` field of [Cyclic Module Record](https://tc39.es/ecma262/#sec-cyclic-module-records) s in
|
799
|
-
* the ECMAScript specification.
|
800
|
-
*/
|
801
|
-
dependencySpecifiers: readonly string[];
|
802
794
|
/**
|
803
795
|
* If the `module.status` is `'errored'`, this property contains the exception
|
804
796
|
* thrown by the module during evaluation. If the status is anything else,
|
@@ -918,6 +910,25 @@ declare module "vm" {
|
|
918
910
|
*/
|
919
911
|
importModuleDynamically?: DynamicModuleLoader<SourceTextModule> | undefined;
|
920
912
|
}
|
913
|
+
/**
|
914
|
+
* A `ModuleRequest` represents the request to import a module with given import attributes and phase.
|
915
|
+
* @since 24.4.0
|
916
|
+
*/
|
917
|
+
interface ModuleRequest {
|
918
|
+
/**
|
919
|
+
* The specifier of the requested module.
|
920
|
+
*/
|
921
|
+
specifier: string;
|
922
|
+
/**
|
923
|
+
* The `"with"` value passed to the `WithClause` in a `ImportDeclaration`, or an empty object if no value was
|
924
|
+
* provided.
|
925
|
+
*/
|
926
|
+
attributes: ImportAttributes;
|
927
|
+
/**
|
928
|
+
* The phase of the requested module (`"source"` or `"evaluation"`).
|
929
|
+
*/
|
930
|
+
phase: ImportPhase;
|
931
|
+
}
|
921
932
|
/**
|
922
933
|
* This feature is only available with the `--experimental-vm-modules` command
|
923
934
|
* flag enabled.
|
@@ -933,6 +944,58 @@ declare module "vm" {
|
|
933
944
|
* @param code JavaScript Module code to parse
|
934
945
|
*/
|
935
946
|
constructor(code: string, options?: SourceTextModuleOptions);
|
947
|
+
/**
|
948
|
+
* @deprecated Use `sourceTextModule.moduleRequests` instead.
|
949
|
+
*/
|
950
|
+
readonly dependencySpecifiers: readonly string[];
|
951
|
+
/**
|
952
|
+
* The requested import dependencies of this module. The returned array is frozen
|
953
|
+
* to disallow any changes to it.
|
954
|
+
*
|
955
|
+
* For example, given a source text:
|
956
|
+
*
|
957
|
+
* ```js
|
958
|
+
* import foo from 'foo';
|
959
|
+
* import fooAlias from 'foo';
|
960
|
+
* import bar from './bar.js';
|
961
|
+
* import withAttrs from '../with-attrs.ts' with { arbitraryAttr: 'attr-val' };
|
962
|
+
* import source Module from 'wasm-mod.wasm';
|
963
|
+
* ```
|
964
|
+
*
|
965
|
+
* The value of the `sourceTextModule.moduleRequests` will be:
|
966
|
+
*
|
967
|
+
* ```js
|
968
|
+
* [
|
969
|
+
* {
|
970
|
+
* specifier: 'foo',
|
971
|
+
* attributes: {},
|
972
|
+
* phase: 'evaluation',
|
973
|
+
* },
|
974
|
+
* {
|
975
|
+
* specifier: 'foo',
|
976
|
+
* attributes: {},
|
977
|
+
* phase: 'evaluation',
|
978
|
+
* },
|
979
|
+
* {
|
980
|
+
* specifier: './bar.js',
|
981
|
+
* attributes: {},
|
982
|
+
* phase: 'evaluation',
|
983
|
+
* },
|
984
|
+
* {
|
985
|
+
* specifier: '../with-attrs.ts',
|
986
|
+
* attributes: { arbitraryAttr: 'attr-val' },
|
987
|
+
* phase: 'evaluation',
|
988
|
+
* },
|
989
|
+
* {
|
990
|
+
* specifier: 'wasm-mod.wasm',
|
991
|
+
* attributes: {},
|
992
|
+
* phase: 'source',
|
993
|
+
* },
|
994
|
+
* ];
|
995
|
+
* ```
|
996
|
+
* @since v24.4.0
|
997
|
+
*/
|
998
|
+
readonly moduleRequests: readonly ModuleRequest[];
|
936
999
|
}
|
937
1000
|
interface SyntheticModuleOptions {
|
938
1001
|
/**
|
node/wasi.d.ts
CHANGED
@@ -121,6 +121,12 @@ declare module "wasi" {
|
|
121
121
|
*/
|
122
122
|
version: "unstable" | "preview1";
|
123
123
|
}
|
124
|
+
interface FinalizeBindingsOptions {
|
125
|
+
/**
|
126
|
+
* @default instance.exports.memory
|
127
|
+
*/
|
128
|
+
memory?: object | undefined;
|
129
|
+
}
|
124
130
|
/**
|
125
131
|
* The `WASI` class provides the WASI system call API and additional convenience
|
126
132
|
* methods for working with WASI-based applications. Each `WASI` instance
|
@@ -167,6 +173,21 @@ declare module "wasi" {
|
|
167
173
|
* @since v14.6.0, v12.19.0
|
168
174
|
*/
|
169
175
|
initialize(instance: object): void; // TODO: avoid DOM dependency until WASM moved to own lib.
|
176
|
+
/**
|
177
|
+
* Set up WASI host bindings to `instance` without calling `initialize()`
|
178
|
+
* or `start()`. This method is useful when the WASI module is instantiated in
|
179
|
+
* child threads for sharing the memory across threads.
|
180
|
+
*
|
181
|
+
* `finalizeBindings()` requires that either `instance` exports a
|
182
|
+
* [`WebAssembly.Memory`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory) named `memory` or user specify a
|
183
|
+
* [`WebAssembly.Memory`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory) object in `options.memory`. If the `memory` is invalid
|
184
|
+
* an exception is thrown.
|
185
|
+
*
|
186
|
+
* `start()` and `initialize()` will call `finalizeBindings()` internally.
|
187
|
+
* If `finalizeBindings()` is called more than once, an exception is thrown.
|
188
|
+
* @since v24.4.0
|
189
|
+
*/
|
190
|
+
finalizeBindings(instance: object, options?: FinalizeBindingsOptions): void;
|
170
191
|
/**
|
171
192
|
* `wasiImport` is an object that implements the WASI system call API. This object
|
172
193
|
* should be passed as the `wasi_snapshot_preview1` import during the instantiation
|
node/worker_threads.d.ts
CHANGED
@@ -739,6 +739,24 @@ declare module "worker_threads" {
|
|
739
739
|
* for the `key` will be deleted.
|
740
740
|
*/
|
741
741
|
function setEnvironmentData(key: Serializable, value?: Serializable): void;
|
742
|
+
/**
|
743
|
+
* Sends a value to another worker, identified by its thread ID.
|
744
|
+
* @param threadId The target thread ID. If the thread ID is invalid, a `ERR_WORKER_MESSAGING_FAILED` error will be thrown.
|
745
|
+
* If the target thread ID is the current thread ID, a `ERR_WORKER_MESSAGING_SAME_THREAD` error will be thrown.
|
746
|
+
* @param value The value to send.
|
747
|
+
* @param transferList If one or more `MessagePort`-like objects are passed in value, a `transferList` is required for those items
|
748
|
+
* or `ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST` is thrown. See `port.postMessage()` for more information.
|
749
|
+
* @param timeout Time to wait for the message to be delivered in milliseconds. By default it's `undefined`, which means wait forever.
|
750
|
+
* If the operation times out, a `ERR_WORKER_MESSAGING_TIMEOUT` error is thrown.
|
751
|
+
* @since v22.5.0
|
752
|
+
*/
|
753
|
+
function postMessageToThread(threadId: number, value: any, timeout?: number): Promise<void>;
|
754
|
+
function postMessageToThread(
|
755
|
+
threadId: number,
|
756
|
+
value: any,
|
757
|
+
transferList: readonly Transferable[],
|
758
|
+
timeout?: number,
|
759
|
+
): Promise<void>;
|
742
760
|
|
743
761
|
import {
|
744
762
|
BroadcastChannel as _BroadcastChannel,
|