expose more FS methods to ts

So I can use them in typescript project without syntax error.
This commit is contained in:
Zheng (Jeff) Xu 2022-07-20 07:44:25 -04:00
parent fcc312abd3
commit 6f29d79862
2 changed files with 6 additions and 1 deletions

3
.gitignore vendored
View File

@ -2,3 +2,6 @@ node_modules
dist dist
/.nyc_output /.nyc_output
.DS_Store .DS_Store
# ide
.idea/

2
src/index.d.ts vendored
View File

@ -2,6 +2,8 @@ export const FS: {
writeFile: (fileName: string, binaryData: Uint8Array) => void, writeFile: (fileName: string, binaryData: Uint8Array) => void,
readFile: (fileName: string) => Uint8Array, readFile: (fileName: string) => Uint8Array,
unlink: (fileName: string) => void, unlink: (fileName: string) => void,
mkdir: (fileName: string) => void,
readdir: (fileName: string) => string[],
} }
type FSMethodNames = { [K in keyof typeof FS]: (typeof FS)[K] extends (...args: any[]) => any ? K : never }[keyof typeof FS]; type FSMethodNames = { [K in keyof typeof FS]: (typeof FS)[K] extends (...args: any[]) => any ? K : never }[keyof typeof FS];