Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions types/node/fs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,13 @@ declare module "fs" {
name: string;
/**
* The base path that this `fs.Dirent` object refers to.
* @since v20.12.0
*/
parentPath: string;
/**
* Alias for `dirent.parentPath`.
* @since v20.1.0
* @deprecated Since v20.12.0
*/
path: string;
}
Expand Down
2 changes: 2 additions & 0 deletions types/node/test/fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,8 @@ async function testPromisify() {
{
fs.opendir("test", async (err, dir) => {
const dirEnt: fs.Dirent | null = await dir.read();
dirEnt?.parentPath; // $ExpectType string | undefined
dirEnt?.path; // $ExpectType string | undefined
});

fs.opendir(Buffer.from("test"), async (err, dir) => {
Expand Down
6 changes: 6 additions & 0 deletions types/node/v18/fs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,13 @@ declare module "fs" {
name: string;
/**
* The base path that this `fs.Dirent` object refers to.
* @since v18.20.0
*/
parentPath: string;
/**
* Alias for `dirent.parentPath`.
* @since v18.17.0
* @deprecated Since v18.20.0
*/
path: string;
}
Expand Down
1 change: 1 addition & 0 deletions types/node/v18/test/fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ async function testPromisify() {
{
fs.opendir("test", async (err, dir) => {
const dirEnt: fs.Dirent | null = await dir.read();
dirEnt?.parentPath; // $ExpectType string | undefined
dirEnt?.path; // $ExpectType string | undefined
});

Expand Down