@@ -138,48 +138,41 @@ class FakeFileSystemAPI implements FileSystemAPI {
138
138
path : string ,
139
139
options : { encoding ?: string | null | undefined ; withFileTypes : true } ,
140
140
) : Promise < DirEnt < string > [ ] > ;
141
- readdir (
141
+ async readdir (
142
142
path : unknown ,
143
143
options ?: { encoding ?: string | null | undefined ; withFileTypes ?: boolean } | string | null ,
144
- ) :
145
- | Promise < Uint8Array [ ] >
146
- | Promise < string [ ] >
147
- | Promise < DirEnt < Uint8Array > [ ] >
148
- | Promise < DirEnt < string > [ ] > {
144
+ ) : Promise < Uint8Array [ ] | string [ ] | DirEnt < Uint8Array > [ ] | DirEnt < string > [ ] > {
149
145
if ( typeof options === 'object' && options ?. withFileTypes === true ) {
150
- return Promise . resolve ( [ { name : 'fake-file' , isFile : ( ) => true , isDirectory : ( ) => false } ] ) ;
146
+ return [ { name : 'fake-file' , isFile : ( ) => true , isDirectory : ( ) => false } ] ;
151
147
}
152
148
153
- return Promise . resolve ( [ '/fake-dirname' ] ) ;
149
+ return [ '/fake-dirname' ] ;
154
150
}
155
151
156
152
readFile ( path : string , encoding ?: null | undefined ) : Promise < Uint8Array > ;
157
153
readFile ( path : string , encoding : string ) : Promise < string > ;
158
154
readFile ( path : unknown , encoding ?: unknown ) : Promise < Uint8Array > | Promise < string > {
159
155
return Promise . resolve ( 'fake file content' ) ;
160
156
}
161
- writeFile (
157
+ async writeFile (
162
158
path : string ,
163
159
data : string | Uint8Array ,
164
160
options ?: string | { encoding ?: string | null | undefined } | null | undefined ,
165
- ) : Promise < void > {
166
- return Promise . resolve ( ) ;
167
- }
161
+ ) : Promise < void > { }
162
+
168
163
mkdir ( path : string , options ?: { recursive ?: false | undefined } | undefined ) : Promise < void > ;
169
164
mkdir ( path : string , options : { recursive : true } ) : Promise < string > ;
170
- mkdir ( path : unknown , options ?: unknown ) : Promise < void > | Promise < string > {
171
- return Promise . resolve ( ) ;
172
- }
173
- rm (
165
+ async mkdir ( path : unknown , options ?: unknown ) : Promise < void | string > { }
166
+
167
+ async rm (
174
168
path : string ,
175
169
options ?: { force ?: boolean | undefined ; recursive ?: boolean | undefined } | undefined ,
176
- ) : Promise < void > {
177
- return Promise . resolve ( ) ;
178
- }
170
+ ) : Promise < void > { }
179
171
180
172
rename ( oldPath : string , newPath : string ) : Promise < void > {
181
173
throw Error ( 'Not implemented' ) ;
182
174
}
175
+
183
176
watch (
184
177
filename : string ,
185
178
options ?: FSWatchOptions | undefined ,
0 commit comments