This repository has been archived on 2026-09-03. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
open-brainy/src/types/fileSystemTypes.ts
dpsifr e1632523b4 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.
2025-07-21 12:48:03 -07:00

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