@@ -46,7 +46,11 @@ const {
46
46
47
47
/**
48
48
* @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
50
54
*/
51
55
52
56
/** @typedef {(err: NodeJS.ErrnoException | null, result?: string) => void } StringCallback */
@@ -56,10 +60,6 @@ const {
56
60
/** @typedef {(err: NodeJS.ErrnoException | null, result?: IBigIntStats) => void } BigIntStatsCallback */
57
61
/** @typedef {(err: NodeJS.ErrnoException | null, result?: (IStats | IBigIntStats)) => void } StatsOrBigIntStatsCallback */
58
62
/** @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 */
63
63
64
64
/**
65
65
* @template T
@@ -96,10 +96,12 @@ const {
96
96
*/
97
97
98
98
/**
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
100
100
*/
101
101
102
+ /* eslint-disable jsdoc/require-template */
102
103
/**
104
+ * @template {string | Buffer} [T=string]
103
105
* @typedef {object } Dirent
104
106
* @property {() => boolean } isFile true when is file, otherwise false
105
107
* @property {() => boolean } isDirectory true when is directory, otherwise false
@@ -108,9 +110,11 @@ const {
108
110
* @property {() => boolean } isSymbolicLink true when is symbolic link, otherwise false
109
111
* @property {() => boolean } isFIFO true when is FIFO, otherwise false
110
112
* @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
113
116
*/
117
+ /* eslint-enable jsdoc/require-template */
114
118
115
119
/**
116
120
* @typedef {object } StatOptions
@@ -132,10 +136,6 @@ const {
132
136
* }} ReadFile
133
137
*/
134
138
135
- /**
136
- * @typedef {ObjectEncodingOptions | BufferEncoding | undefined | null } EncodingOption
137
- */
138
-
139
139
/**
140
140
* @typedef {'buffer'| { encoding: 'buffer' } } BufferEncodingOption
141
141
*/
@@ -150,23 +150,26 @@ const {
150
150
151
151
/**
152
152
* @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;
158
159
* }} Readdir
159
160
*/
160
161
161
162
/**
162
163
* @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[];
164
165
* (path: PathLike, options: { encoding: 'buffer', withFileTypes?: false | undefined, recursive?: boolean | undefined } | 'buffer'): Buffer[];
165
166
* (path: PathLike, options?: (ObjectEncodingOptions & { withFileTypes?: false | undefined, recursive?: boolean | undefined }) | BufferEncoding | null): string[] | Buffer[];
166
167
* (path: PathLike, options: ObjectEncodingOptions & { withFileTypes: true, recursive?: boolean | undefined }): Dirent[];
168
+ * (path: PathLike, options: { encoding: "buffer", withFileTypes: true, recursive?: boolean | undefined }): Dirent<Buffer>[];
167
169
* }} ReaddirSync
168
- *
169
- * /**
170
+ */
171
+
172
+ /**
170
173
* @typedef {(pathOrFileDescription: PathOrFileDescriptor, callback: ReadJsonCallback) => void } ReadJson
171
174
*/
172
175
0 commit comments