- 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.
24 lines
876 B
TypeScript
24 lines
876 B
TypeScript
/**
|
|
* 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]>;
|
|
}
|
|
|
|
// 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
|