Skip to content

Commit

Permalink
feat: add type (undefined | 'buffer') to readdir
Browse files Browse the repository at this point in the history
  • Loading branch information
fu1996 committed Mar 19, 2023
1 parent b7ca4f6 commit 114d565
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/Resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ const {

/**
* @typedef {Object} ReaddirOptions
* @property {BufferEncoding | null} [encoding]
* @property {boolean} [withFileTypes=false]
* @property {BufferEncoding | null | 'buffer'} [encoding]
* @property {boolean | undefined} [withFileTypes=false]
*/

/**
* @typedef {Object} FileSystem
* @property {(function(string, FileSystemCallback<Buffer | string>): void) & function(string, object, FileSystemCallback<Buffer | string>): void} readFile
* @property {function(string, (ReaddirOptions | BufferEncoding | null | DirentArrayCallback)=, DirentArrayCallback=): void} readdir
* @property {function(string, (ReaddirOptions | BufferEncoding | null | undefined | 'buffer' | DirentArrayCallback)=, DirentArrayCallback=): void} readdir
* @property {((function(string, FileSystemCallback<object>): void) & function(string, object, FileSystemCallback<object>): void)=} readJson
* @property {(function(string, FileSystemCallback<Buffer | string>): void) & function(string, object, FileSystemCallback<Buffer | string>): void} readlink
* @property {(function(string, FileSystemCallback<FileSystemStats>): void) & function(string, object, FileSystemCallback<Buffer | string>): void=} lstat
Expand Down
9 changes: 6 additions & 3 deletions types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ declare class CachedInputFileSystem {
| "base64"
| "latin1"
| "binary"
| "hex",
| "hex"
| "buffer",
arg2?: (
arg0?: null | NodeJS.ErrnoException,
arg1?: (string | Buffer)[] | any[]
Expand Down Expand Up @@ -138,7 +139,8 @@ declare interface FileSystem {
| "base64"
| "latin1"
| "binary"
| "hex",
| "hex"
| "buffer",
arg2?: (
arg0?: null | NodeJS.ErrnoException,
arg1?: (string | Buffer)[] | any[]
Expand Down Expand Up @@ -223,7 +225,8 @@ declare interface ReaddirOptions {
| "base64"
| "latin1"
| "binary"
| "hex";
| "hex"
| "buffer";
withFileTypes?: boolean;
}

Expand Down

0 comments on commit 114d565

Please sign in to comment.