-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add withFileTypes in FileSystem #374
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,17 +45,30 @@ declare class CachedInputFileSystem { | |
): void; | ||
}; | ||
statSync: (arg0: string, arg1?: object) => FileSystemStats; | ||
readdir: { | ||
( | ||
arg0: string, | ||
arg1: FileSystemCallback<(string | Buffer)[] | FileSystemDirent[]> | ||
): void; | ||
( | ||
arg0: string, | ||
arg1: object, | ||
arg2: FileSystemCallback<(string | Buffer)[] | FileSystemDirent[]> | ||
): void; | ||
}; | ||
readdir: ( | ||
arg0: string, | ||
arg1?: | ||
| null | ||
| (( | ||
arg0?: null | NodeJS.ErrnoException, | ||
arg1?: (string | Buffer)[] | any[] | ||
) => void) | ||
| ReaddirOptions | ||
| "ascii" | ||
| "utf8" | ||
| "utf-8" | ||
| "utf16le" | ||
| "ucs2" | ||
| "ucs-2" | ||
| "base64" | ||
| "latin1" | ||
| "binary" | ||
| "hex", | ||
arg2?: ( | ||
arg0?: null | NodeJS.ErrnoException, | ||
arg1?: (string | Buffer)[] | any[] | ||
) => void | ||
) => void; | ||
readdirSync: ( | ||
arg0: string, | ||
arg1?: object | ||
|
@@ -107,17 +120,30 @@ declare interface FileSystem { | |
arg2: FileSystemCallback<string | Buffer> | ||
): void; | ||
}; | ||
readdir: { | ||
( | ||
arg0: string, | ||
arg1: FileSystemCallback<(string | Buffer)[] | FileSystemDirent[]> | ||
): void; | ||
( | ||
arg0: string, | ||
arg1: object, | ||
arg2: FileSystemCallback<(string | Buffer)[] | FileSystemDirent[]> | ||
): void; | ||
}; | ||
readdir: ( | ||
arg0: string, | ||
arg1?: | ||
| null | ||
| (( | ||
arg0?: null | NodeJS.ErrnoException, | ||
arg1?: (string | Buffer)[] | any[] | ||
) => void) | ||
| ReaddirOptions | ||
| "ascii" | ||
| "utf8" | ||
| "utf-8" | ||
| "utf16le" | ||
| "ucs2" | ||
| "ucs-2" | ||
| "base64" | ||
| "latin1" | ||
| "binary" | ||
| "hex", | ||
arg2?: ( | ||
arg0?: null | NodeJS.ErrnoException, | ||
arg1?: (string | Buffer)[] | any[] | ||
) => void | ||
) => void; | ||
readJson?: { | ||
(arg0: string, arg1: FileSystemCallback<object>): void; | ||
(arg0: string, arg1: object, arg2: FileSystemCallback<object>): void; | ||
|
@@ -185,6 +211,21 @@ declare interface PossibleFileSystemError { | |
path?: string; | ||
syscall?: string; | ||
} | ||
declare interface ReaddirOptions { | ||
encoding?: | ||
| null | ||
| "ascii" | ||
| "utf8" | ||
| "utf-8" | ||
| "utf16le" | ||
| "ucs2" | ||
| "ucs-2" | ||
| "base64" | ||
| "latin1" | ||
| "binary" | ||
| "hex"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's create a new type There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just for infromation, here is node types for such method:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
"This types.d.ts is automatically generated by running the 'yarn special lint fix' command. I think what I can do is modify the jsDoc syntax in 'Resolver. js' to generate it, but I cannot control the addition of' ascii '|' utf8 '|' utf-8 '|' utf16le '|' ucs2 '|' ucs-2 '|' base64 '|' latin1 '|' binary '|' hex ';"; "Force the use of the BufferEncoding type, even if I manually modify it after running the 'yarn special lint fix' command, but I don't think this is a good method. Do you have any good ideas for controlling the use of the BufferEncoding type instead of its corresponding enumeration value?"? The following figure shows that after I manually changed to BufferEncoding and executed the 'yarn special lint fix' command, my manual modification was invalid |
||
withFileTypes?: boolean; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is possible to pass |
||
} | ||
|
||
/** | ||
* Resolve context | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
undefined
possible too