@types/node 22.15.15 → 22.15.17

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.
Files changed (5) hide show
  1. node/README.md +1 -1
  2. node/fs/promises.d.ts +13 -0
  3. node/fs.d.ts +42 -2
  4. node/package.json +2 -2
  5. node/vm.d.ts +13 -4
node/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Wed, 07 May 2025 15:38:50 GMT
11
+ * Last updated: Thu, 08 May 2025 14:02:18 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
node/fs/promises.d.ts CHANGED
@@ -718,6 +718,19 @@ declare module "fs/promises" {
718
718
  recursive?: boolean | undefined;
719
719
  },
720
720
  ): Promise<Dirent[]>;
721
+ /**
722
+ * Asynchronous readdir(3) - read a directory.
723
+ * @param path A path to a directory. If a URL is provided, it must use the `file:` protocol.
724
+ * @param options Must include `withFileTypes: true` and `encoding: 'buffer'`.
725
+ */
726
+ function readdir(
727
+ path: PathLike,
728
+ options: {
729
+ encoding: "buffer";
730
+ withFileTypes: true;
731
+ recursive?: boolean | undefined;
732
+ },
733
+ ): Promise<Dirent<Buffer>[]>;
721
734
  /**
722
735
  * Reads the contents of the symbolic link referred to by `path`. See the POSIX [`readlink(2)`](http://man7.org/linux/man-pages/man2/readlink.2.html) documentation for more detail. The promise is
723
736
  * fulfilled with the`linkString` upon success.
node/fs.d.ts CHANGED
@@ -198,7 +198,7 @@ declare module "fs" {
198
198
  * the `withFileTypes` option set to `true`, the resulting array is filled with `fs.Dirent` objects, rather than strings or `Buffer` s.
199
199
  * @since v10.10.0
200
200
  */
201
- export class Dirent {
201
+ export class Dirent<Name extends string | Buffer = string> {
202
202
  /**
203
203
  * Returns `true` if the `fs.Dirent` object describes a regular file.
204
204
  * @since v10.10.0
@@ -241,7 +241,7 @@ declare module "fs" {
241
241
  * value is determined by the `options.encoding` passed to {@link readdir} or {@link readdirSync}.
242
242
  * @since v10.10.0
243
243
  */
244
- name: string;
244
+ name: Name;
245
245
  /**
246
246
  * The base path that this `fs.Dirent` object refers to.
247
247
  * @since v20.12.0
@@ -2040,6 +2040,20 @@ declare module "fs" {
2040
2040
  },
2041
2041
  callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void,
2042
2042
  ): void;
2043
+ /**
2044
+ * Asynchronous readdir(3) - read a directory.
2045
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2046
+ * @param options Must include `withFileTypes: true` and `encoding: 'buffer'`.
2047
+ */
2048
+ export function readdir(
2049
+ path: PathLike,
2050
+ options: {
2051
+ encoding: "buffer";
2052
+ withFileTypes: true;
2053
+ recursive?: boolean | undefined;
2054
+ },
2055
+ callback: (err: NodeJS.ErrnoException | null, files: Dirent<Buffer>[]) => void,
2056
+ ): void;
2043
2057
  export namespace readdir {
2044
2058
  /**
2045
2059
  * Asynchronous readdir(3) - read a directory.
@@ -2099,6 +2113,19 @@ declare module "fs" {
2099
2113
  recursive?: boolean | undefined;
2100
2114
  },
2101
2115
  ): Promise<Dirent[]>;
2116
+ /**
2117
+ * Asynchronous readdir(3) - read a directory.
2118
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2119
+ * @param options Must include `withFileTypes: true` and `encoding: 'buffer'`.
2120
+ */
2121
+ function __promisify__(
2122
+ path: PathLike,
2123
+ options: {
2124
+ encoding: "buffer";
2125
+ withFileTypes: true;
2126
+ recursive?: boolean | undefined;
2127
+ },
2128
+ ): Promise<Dirent<Buffer>[]>;
2102
2129
  }
2103
2130
  /**
2104
2131
  * Reads the contents of the directory.
@@ -2166,6 +2193,19 @@ declare module "fs" {
2166
2193
  recursive?: boolean | undefined;
2167
2194
  },
2168
2195
  ): Dirent[];
2196
+ /**
2197
+ * Synchronous readdir(3) - read a directory.
2198
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2199
+ * @param options Must include `withFileTypes: true` and `encoding: 'buffer'`.
2200
+ */
2201
+ export function readdirSync(
2202
+ path: PathLike,
2203
+ options: {
2204
+ encoding: "buffer";
2205
+ withFileTypes: true;
2206
+ recursive?: boolean | undefined;
2207
+ },
2208
+ ): Dirent<Buffer>[];
2169
2209
  /**
2170
2210
  * Closes the file descriptor. No arguments other than a possible exception are
2171
2211
  * given to the completion callback.
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "22.15.15",
3
+ "version": "22.15.17",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -220,6 +220,6 @@
220
220
  "undici-types": "~6.21.0"
221
221
  },
222
222
  "peerDependencies": {},
223
- "typesPublisherContentHash": "b146701cf123607334c953e05ff2160554ad05758ef53d79cbed2506e7c4b1fa",
223
+ "typesPublisherContentHash": "fc6995b0ade0c0c7fd18806f0d2dd27d7dd424e1afc0efb8ee459ab933f67239",
224
224
  "typeScriptVersion": "5.1"
225
225
  }
node/vm.d.ts CHANGED
@@ -58,7 +58,7 @@ declare module "vm" {
58
58
  }
59
59
  interface ScriptOptions extends BaseOptions {
60
60
  /**
61
- * V8's code cache data for the supplied source.
61
+ * Provides an optional data with V8's code cache data for the supplied source.
62
62
  */
63
63
  cachedData?: Buffer | NodeJS.ArrayBufferView | undefined;
64
64
  /** @deprecated in favor of `script.createCachedData()` */
@@ -110,18 +110,24 @@ declare module "vm" {
110
110
  microtaskMode?: CreateContextOptions["microtaskMode"];
111
111
  }
112
112
  interface RunningCodeOptions extends RunningScriptOptions {
113
- cachedData?: ScriptOptions["cachedData"];
113
+ /**
114
+ * Provides an optional data with V8's code cache data for the supplied source.
115
+ */
116
+ cachedData?: ScriptOptions["cachedData"] | undefined;
114
117
  importModuleDynamically?: ScriptOptions["importModuleDynamically"];
115
118
  }
116
119
  interface RunningCodeInNewContextOptions extends RunningScriptInNewContextOptions {
117
- cachedData?: ScriptOptions["cachedData"];
120
+ /**
121
+ * Provides an optional data with V8's code cache data for the supplied source.
122
+ */
123
+ cachedData?: ScriptOptions["cachedData"] | undefined;
118
124
  importModuleDynamically?: ScriptOptions["importModuleDynamically"];
119
125
  }
120
126
  interface CompileFunctionOptions extends BaseOptions {
121
127
  /**
122
128
  * Provides an optional data with V8's code cache data for the supplied source.
123
129
  */
124
- cachedData?: Buffer | undefined;
130
+ cachedData?: ScriptOptions["cachedData"] | undefined;
125
131
  /**
126
132
  * Specifies whether to produce new cache data.
127
133
  * @default false
@@ -848,6 +854,9 @@ declare module "vm" {
848
854
  * @default 'vm:module(i)' where i is a context-specific ascending index.
849
855
  */
850
856
  identifier?: string | undefined;
857
+ /**
858
+ * Provides an optional data with V8's code cache data for the supplied source.
859
+ */
851
860
  cachedData?: ScriptOptions["cachedData"] | undefined;
852
861
  context?: Context | undefined;
853
862
  lineOffset?: BaseOptions["lineOffset"] | undefined;