feat(types): extend FileSystemHandle and optimize imports for consistency
- Added `getFile` method to `FileSystemHandle` interface for enhanced TypeScript compatibility with File System Access API. - Improved maintainability by reformatting and aligning imports in `brainyData.ts`. - Standardized spacing and indentation across structured comments and interface fields. Purpose: Improve TypeScript support for file system operations and enhance code readability with consistent formatting and import management.
This commit is contained in:
parent
87957d8fe7
commit
d95e86ace4
4 changed files with 2745 additions and 2723 deletions
|
|
@ -1,14 +1,24 @@
|
|||
/**
|
||||
* Type declarations for the File System Access API
|
||||
* Extends the FileSystemDirectoryHandle interface to include the [Symbol.asyncIterator] method
|
||||
* and FileSystemHandle to include getFile() method for TypeScript compatibility
|
||||
*/
|
||||
|
||||
// Extend the FileSystemDirectoryHandle interface
|
||||
interface FileSystemDirectoryHandle {
|
||||
[Symbol.asyncIterator](): AsyncIterableIterator<[string, FileSystemHandle]>;
|
||||
keys(): AsyncIterableIterator<string>;
|
||||
entries(): AsyncIterableIterator<[string, FileSystemHandle]>;
|
||||
[Symbol.asyncIterator](): AsyncIterableIterator<[string, FileSystemHandle]>;
|
||||
|
||||
keys(): AsyncIterableIterator<string>;
|
||||
|
||||
entries(): AsyncIterableIterator<[string, FileSystemHandle]>;
|
||||
}
|
||||
|
||||
// Extend the FileSystemHandle interface to include getFile method
|
||||
// This is needed because TypeScript doesn't recognize that a FileSystemHandle
|
||||
// can be a FileSystemFileHandle which has the getFile method
|
||||
interface FileSystemHandle {
|
||||
getFile?(): Promise<File>;
|
||||
}
|
||||
|
||||
// Export something to make this a module
|
||||
export const fileSystemTypesLoaded = true;
|
||||
export const fileSystemTypesLoaded = true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue