@types/node 20.17.43 → 20.17.45

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 v20.17/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/v20.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Tue, 06 May 2025 18:02:39 GMT
11
+ * Last updated: Thu, 08 May 2025 03:33:47 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
@@ -710,6 +710,19 @@ declare module "fs/promises" {
710
710
  recursive?: boolean | undefined;
711
711
  },
712
712
  ): Promise<Dirent[]>;
713
+ /**
714
+ * Asynchronous readdir(3) - read a directory.
715
+ * @param path A path to a directory. If a URL is provided, it must use the `file:` protocol.
716
+ * @param options Must include `withFileTypes: true` and `encoding: 'buffer'`.
717
+ */
718
+ function readdir(
719
+ path: PathLike,
720
+ options: {
721
+ encoding: "buffer";
722
+ withFileTypes: true;
723
+ recursive?: boolean | undefined;
724
+ },
725
+ ): Promise<Dirent<Buffer>[]>;
713
726
  /**
714
727
  * 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
715
728
  * fulfilled with the`linkString` upon success.
node v20.17/fs.d.ts CHANGED
@@ -196,7 +196,7 @@ declare module "fs" {
196
196
  * the `withFileTypes` option set to `true`, the resulting array is filled with `fs.Dirent` objects, rather than strings or `Buffer` s.
197
197
  * @since v10.10.0
198
198
  */
199
- export class Dirent {
199
+ export class Dirent<Name extends string | Buffer = string> {
200
200
  /**
201
201
  * Returns `true` if the `fs.Dirent` object describes a regular file.
202
202
  * @since v10.10.0
@@ -239,7 +239,7 @@ declare module "fs" {
239
239
  * value is determined by the `options.encoding` passed to {@link readdir} or {@link readdirSync}.
240
240
  * @since v10.10.0
241
241
  */
242
- name: string;
242
+ name: Name;
243
243
  /**
244
244
  * The base path that this `fs.Dirent` object refers to.
245
245
  * @since v20.12.0
@@ -2038,6 +2038,20 @@ declare module "fs" {
2038
2038
  },
2039
2039
  callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void,
2040
2040
  ): void;
2041
+ /**
2042
+ * Asynchronous readdir(3) - read a directory.
2043
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2044
+ * @param options Must include `withFileTypes: true` and `encoding: 'buffer'`.
2045
+ */
2046
+ export function readdir(
2047
+ path: PathLike,
2048
+ options: {
2049
+ encoding: "buffer";
2050
+ withFileTypes: true;
2051
+ recursive?: boolean | undefined;
2052
+ },
2053
+ callback: (err: NodeJS.ErrnoException | null, files: Dirent<Buffer>[]) => void,
2054
+ ): void;
2041
2055
  export namespace readdir {
2042
2056
  /**
2043
2057
  * Asynchronous readdir(3) - read a directory.
@@ -2097,6 +2111,19 @@ declare module "fs" {
2097
2111
  recursive?: boolean | undefined;
2098
2112
  },
2099
2113
  ): Promise<Dirent[]>;
2114
+ /**
2115
+ * Asynchronous readdir(3) - read a directory.
2116
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2117
+ * @param options Must include `withFileTypes: true` and `encoding: 'buffer'`.
2118
+ */
2119
+ function __promisify__(
2120
+ path: PathLike,
2121
+ options: {
2122
+ encoding: "buffer";
2123
+ withFileTypes: true;
2124
+ recursive?: boolean | undefined;
2125
+ },
2126
+ ): Promise<Dirent<Buffer>[]>;
2100
2127
  }
2101
2128
  /**
2102
2129
  * Reads the contents of the directory.
@@ -2164,6 +2191,19 @@ declare module "fs" {
2164
2191
  recursive?: boolean | undefined;
2165
2192
  },
2166
2193
  ): Dirent[];
2194
+ /**
2195
+ * Synchronous readdir(3) - read a directory.
2196
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2197
+ * @param options Must include `withFileTypes: true` and `encoding: 'buffer'`.
2198
+ */
2199
+ export function readdirSync(
2200
+ path: PathLike,
2201
+ options: {
2202
+ encoding: "buffer";
2203
+ withFileTypes: true;
2204
+ recursive?: boolean | undefined;
2205
+ },
2206
+ ): Dirent<Buffer>[];
2167
2207
  /**
2168
2208
  * Closes the file descriptor. No arguments other than a possible exception are
2169
2209
  * given to the completion callback.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "20.17.43",
3
+ "version": "20.17.45",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -215,6 +215,6 @@
215
215
  "undici-types": "~6.19.2"
216
216
  },
217
217
  "peerDependencies": {},
218
- "typesPublisherContentHash": "cf385e130c412eee6db8c92a5f7f76dd6df4051f21bf1ccc629cfac8880dce07",
218
+ "typesPublisherContentHash": "e7e8138d7a23d355bbf4f61fac4bc6bc6e88821819423ee188af157e4a609489",
219
219
  "typeScriptVersion": "5.1"
220
220
  }
node v20.17/vm.d.ts CHANGED
@@ -69,7 +69,7 @@ declare module "vm" {
69
69
  * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v20.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
70
70
  */
71
71
  importModuleDynamically?:
72
- | ((specifier: string, script: Script, importAttributes: ImportAttributes) => Module)
72
+ | ((specifier: string, script: Script, importAttributes: ImportAttributes) => Module | Promise<Module>)
73
73
  | typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
74
74
  | undefined;
75
75
  }
@@ -815,7 +815,13 @@ declare module "vm" {
815
815
  * Called during evaluation of this module to initialize the `import.meta`.
816
816
  */
817
817
  initializeImportMeta?: ((meta: ImportMeta, module: SourceTextModule) => void) | undefined;
818
- importModuleDynamically?: ScriptOptions["importModuleDynamically"] | undefined;
818
+ importModuleDynamically?:
819
+ | ((
820
+ specifier: string,
821
+ referrer: SourceTextModule,
822
+ importAttributes: ImportAttributes,
823
+ ) => Module | Promise<Module>)
824
+ | undefined;
819
825
  }
820
826
  /**
821
827
  * This feature is only available with the `--experimental-vm-modules` command