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
8 changes: 4 additions & 4 deletions types/node/fs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ declare module "fs" {
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
*/
export function mkdir(path: PathLike, options: MakeDirectoryOptions & { recursive: true }, callback: (err: NodeJS.ErrnoException | null, path: string) => void): void;
export function mkdir(path: PathLike, options: MakeDirectoryOptions & { recursive: true }, callback: (err: NodeJS.ErrnoException | null, path?: string) => void): void;

/**
* Asynchronous mkdir(2) - create a directory.
Expand All @@ -989,7 +989,7 @@ declare module "fs" {
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
*/
export function mkdir(path: PathLike, options: Mode | MakeDirectoryOptions | null | undefined, callback: (err: NodeJS.ErrnoException | null, path: string | undefined) => void): void;
export function mkdir(path: PathLike, options: Mode | MakeDirectoryOptions | null | undefined, callback: (err: NodeJS.ErrnoException | null, path?: string) => void): void;

/**
* Asynchronous mkdir(2) - create a directory with a mode of `0o777`.
Expand All @@ -1005,7 +1005,7 @@ declare module "fs" {
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
*/
function __promisify__(path: PathLike, options: MakeDirectoryOptions & { recursive: true; }): Promise<string>;
function __promisify__(path: PathLike, options: MakeDirectoryOptions & { recursive: true; }): Promise<string | undefined>;

/**
* Asynchronous mkdir(2) - create a directory.
Expand All @@ -1030,7 +1030,7 @@ declare module "fs" {
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
*/
export function mkdirSync(path: PathLike, options: MakeDirectoryOptions & { recursive: true; }): string;
export function mkdirSync(path: PathLike, options: MakeDirectoryOptions & { recursive: true; }): string | undefined;

/**
* Synchronous mkdir(2) - create a directory.
Expand Down
2 changes: 1 addition & 1 deletion types/node/fs/promises.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ declare module 'fs/promises' {
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
*/
function mkdir(path: PathLike, options: MakeDirectoryOptions & { recursive: true; }): Promise<string>;
function mkdir(path: PathLike, options: MakeDirectoryOptions & { recursive: true; }): Promise<string | undefined>;

/**
* Asynchronous mkdir(2) - create a directory.
Expand Down
8 changes: 4 additions & 4 deletions types/node/test/fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,22 +273,22 @@ async function testPromisify() {
mode: 0o777,
}, (err, path) => {
err; // $ExpectType ErrnoException | null
path; // $ExpectType string
path; // $ExpectType string | undefined
});

// $ExpectType string
// $ExpectType string | undefined
fs.mkdirSync('some/test/path', {
recursive: true,
mode: 0o777,
});

// $ExpectType Promise<string>
// $ExpectType Promise<string | undefined>
util.promisify(fs.mkdir)('some/test/path', {
recursive: true,
mode: 0o777,
});

// $ExpectType Promise<string>
// $ExpectType Promise<string | undefined>
fs.promises.mkdir('some/test/path', {
recursive: true,
mode: 0o777,
Expand Down
10 changes: 5 additions & 5 deletions types/node/v13/fs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ declare module "fs" {
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
*/
function mkdir(path: PathLike, options: MakeDirectoryOptions & { recursive: true }, callback: (err: NodeJS.ErrnoException | null, path: string) => void): void;
function mkdir(path: PathLike, options: MakeDirectoryOptions & { recursive: true }, callback: (err: NodeJS.ErrnoException | null, path?: string) => void): void;

/**
* Asynchronous mkdir(2) - create a directory.
Expand All @@ -891,7 +891,7 @@ declare module "fs" {
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
*/
function mkdir(path: PathLike, options: number | string | MakeDirectoryOptions | null | undefined, callback: (err: NodeJS.ErrnoException | null, path: string | undefined) => void): void;
function mkdir(path: PathLike, options: number | string | MakeDirectoryOptions | null | undefined, callback: (err: NodeJS.ErrnoException | null, path?: string) => void): void;

/**
* Asynchronous mkdir(2) - create a directory with a mode of `0o777`.
Expand All @@ -907,7 +907,7 @@ declare module "fs" {
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
*/
function __promisify__(path: PathLike, options: MakeDirectoryOptions & { recursive: true; }): Promise<string>;
function __promisify__(path: PathLike, options: MakeDirectoryOptions & { recursive: true; }): Promise<string | undefined>;

/**
* Asynchronous mkdir(2) - create a directory.
Expand All @@ -932,7 +932,7 @@ declare module "fs" {
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
*/
function mkdirSync(path: PathLike, options: MakeDirectoryOptions & { recursive: true; }): string;
function mkdirSync(path: PathLike, options: MakeDirectoryOptions & { recursive: true; }): string | undefined;

/**
* Synchronous mkdir(2) - create a directory.
Expand Down Expand Up @@ -2382,7 +2382,7 @@ declare module "fs" {
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
*/
function mkdir(path: PathLike, options: MakeDirectoryOptions & { recursive: true; }): Promise<string>;
function mkdir(path: PathLike, options: MakeDirectoryOptions & { recursive: true; }): Promise<string | undefined>;

/**
* Asynchronous mkdir(2) - create a directory.
Expand Down
8 changes: 4 additions & 4 deletions types/node/v13/test/fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,22 +282,22 @@ async function testPromisify() {
mode: 0o777,
}, (err, path) => {
err; // $ExpectType ErrnoException | null
path; // $ExpectType string
path; // $ExpectType string | undefined
});

// $ExpectType string
// $ExpectType string | undefined
fs.mkdirSync('some/test/path', {
recursive: true,
mode: 0o777,
});

// $ExpectType Promise<string>
// $ExpectType Promise<string | undefined>
util.promisify(fs.mkdir)('some/test/path', {
recursive: true,
mode: 0o777,
});

// $ExpectType Promise<string>
// $ExpectType Promise<string | undefined>
fs.promises.mkdir('some/test/path', {
recursive: true,
mode: 0o777,
Expand Down