Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[@types/node] Dirent.path is renamed to Dirent.parentPath #69490

Merged
merged 1 commit into from
May 8, 2024
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.
Jump to
Jump to file
Failed to load files.
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