@@ -46,7 +46,11 @@ const {
4646
4747/**
4848 * @typedef {object } ObjectEncodingOptions
49- * @property {(BufferEncoding | null | undefined)= } encoding encoding
49+ * @property {BufferEncoding | null | undefined= } encoding encoding
50+ */
51+
52+ /**
53+ * @typedef {ObjectEncodingOptions | BufferEncoding | undefined | null } EncodingOption
5054 */
5155
5256/** @typedef {(err: NodeJS.ErrnoException | null, result?: string) => void } StringCallback */
@@ -56,10 +60,6 @@ const {
5660/** @typedef {(err: NodeJS.ErrnoException | null, result?: IBigIntStats) => void } BigIntStatsCallback */
5761/** @typedef {(err: NodeJS.ErrnoException | null, result?: (IStats | IBigIntStats)) => void } StatsOrBigIntStatsCallback */
5862/** @typedef {(err: NodeJS.ErrnoException | Error | null, result?: JsonObject) => void } ReadJsonCallback */
59- /** @typedef {(err: NodeJS.ErrnoException | null, result?: string[]) => void } ReaddirStringCallback */
60- /** @typedef {(err: NodeJS.ErrnoException | null, result?: Buffer[]) => void } ReaddirBufferCallback */
61- /** @typedef {(err: NodeJS.ErrnoException | null, result?: (string[] | Buffer[])) => void } ReaddirStringOrBufferCallback */
62- /** @typedef {(err: NodeJS.ErrnoException | null, result?: Dirent[]) => void } ReaddirDirentCallback */
6363
6464/**
6565 * @template T
@@ -96,10 +96,12 @@ const {
9696 */
9797
9898/**
99- * @typedef {IStatsBase<bigint> & { atimeNs: bigint, mtimeNs: bigint, ctimeNs: bigint, birthtimeNs: bigint } } IBigIntStats
99+ * @typedef {IStatsBase<bigint> & { atimeNs: bigint, mtimeNs: bigint, ctimeNs: bigint, birthtimeNs: bigint } } IBigIntStats
100100 */
101101
102+ /* eslint-disable jsdoc/require-template */
102103/**
104+ * @template {string | Buffer} [T=string]
103105 * @typedef {object } Dirent
104106 * @property {() => boolean } isFile true when is file, otherwise false
105107 * @property {() => boolean } isDirectory true when is directory, otherwise false
@@ -108,9 +110,11 @@ const {
108110 * @property {() => boolean } isSymbolicLink true when is symbolic link, otherwise false
109111 * @property {() => boolean } isFIFO true when is FIFO, otherwise false
110112 * @property {() => boolean } isSocket true when is socket, otherwise false
111- * @property {string } name name
112- * @property {string } path path
113+ * @property {T } name name
114+ * @property {string } parentPath path
115+ * @property {string= } path path
113116 */
117+ /* eslint-enable jsdoc/require-template */
114118
115119/**
116120 * @typedef {object } StatOptions
@@ -132,10 +136,6 @@ const {
132136 * }} ReadFile
133137 */
134138
135- /**
136- * @typedef {ObjectEncodingOptions | BufferEncoding | undefined | null } EncodingOption
137- */
138-
139139/**
140140 * @typedef {'buffer'| { encoding: 'buffer' } } BufferEncodingOption
141141 */
@@ -150,23 +150,26 @@ const {
150150
151151/**
152152 * @typedef {{
153- * (path: PathLike, options: { encoding: BufferEncoding | null, withFileTypes?: false | undefined, recursive?: boolean | undefined } | BufferEncoding | undefined | null, callback: ReaddirStringCallback): void;
154- * (path: PathLike, options: { encoding: 'buffer', withFileTypes?: false | undefined, recursive?: boolean | undefined } | 'buffer', callback: ReaddirBufferCallback): void;
155- * (path: PathLike, callback: ReaddirStringCallback): void;
156- * (path: PathLike, options: (ObjectEncodingOptions & { withFileTypes?: false | undefined, recursive?: boolean | undefined }) | BufferEncoding | undefined | null, callback: ReaddirStringOrBufferCallback): void;
157- * (path: PathLike, options: ObjectEncodingOptions & { withFileTypes: true, recursive?: boolean | undefined }, callback: ReaddirDirentCallback): void;
153+ * (path: PathLike, options: { encoding: BufferEncoding | null, withFileTypes?: false | undefined, recursive?: boolean | undefined } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException | null, files?: string[]) => void): void;
154+ * (path: PathLike, options: { encoding: 'buffer', withFileTypes?: false | undefined, recursive?: boolean | undefined } | 'buffer', callback: (err: NodeJS.ErrnoException | null, files?: Buffer[]) => void): void;
155+ * (path: PathLike, options: (ObjectEncodingOptions & { withFileTypes?: false | undefined, recursive?: boolean | undefined }) | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException | null, files?: string[] | Buffer[]) => void): void;
156+ * (path: PathLike, callback: (err: NodeJS.ErrnoException | null, files?: string[]) => void): void;
157+ * (path: PathLike, options: ObjectEncodingOptions & { withFileTypes: true, recursive?: boolean | undefined }, callback: (err: NodeJS.ErrnoException | null, files?: Dirent<string>[]) => void): void;
158+ * (path: PathLike, options: { encoding: 'buffer', withFileTypes: true, recursive?: boolean | undefined }, callback: (err: NodeJS.ErrnoException | null, files: Dirent<Buffer>[]) => void): void;
158159 * }} Readdir
159160 */
160161
161162/**
162163 * @typedef {{
163- * (path: PathLike, options?: { encoding: BufferEncoding | null, withFileTypes?: false | undefined, recursive?: boolean | undefined } | BufferEncoding | null): string[];
164+ * (path: PathLike, options?: { encoding: BufferEncoding | null, withFileTypes?: false | undefined, recursive?: boolean | undefined; } | BufferEncoding | null): string[];
164165 * (path: PathLike, options: { encoding: 'buffer', withFileTypes?: false | undefined, recursive?: boolean | undefined } | 'buffer'): Buffer[];
165166 * (path: PathLike, options?: (ObjectEncodingOptions & { withFileTypes?: false | undefined, recursive?: boolean | undefined }) | BufferEncoding | null): string[] | Buffer[];
166167 * (path: PathLike, options: ObjectEncodingOptions & { withFileTypes: true, recursive?: boolean | undefined }): Dirent[];
168+ * (path: PathLike, options: { encoding: "buffer", withFileTypes: true, recursive?: boolean | undefined }): Dirent<Buffer>[];
167169 * }} ReaddirSync
168- *
169- * /**
170+ */
171+
172+ /**
170173 * @typedef {(pathOrFileDescription: PathOrFileDescriptor, callback: ReadJsonCallback) => void } ReadJson
171174 */
172175
0 commit comments