feat: add comprehensive FileSystem observer API types with full MDN spec compliance
Added complete TypeScript type definitions for the File System Access API observer interfaces to src/fsa/types.ts, implementing the full MDN specification.
New Types Added
FileSystemChangeRecord
Represents a file system change event with comprehensive properties:
changedHandle: IFileSystemHandle | IFileSystemSyncAccessHandle | null- The changed file system handle (null for "disappeared", "errored", or "unknown" types)relativePathComponents: string[]- Path components from the observed directory to the changed handlerelativePathMovedFrom: string[] | null- Former location path for "moved" type eventsroot: IFileSystemHandle | IFileSystemSyncAccessHandle- Reference to the root handle passed to observe()type: 'appeared' | 'disappeared' | 'modified' | 'moved' | 'errored' | 'unknown'- Complete set of change types
IFileSystemObserver
Observer interface with constructor signature and methods:
- Constructor with callback function
(records, observer) => void observe(handle, options?)- Start observing changes to a directory handleunobserve(handle)- Stop observing changes to a specific directory handledisconnect()- Disconnect and stop all observations
FileSystemObserverObserveOptions
Options interface for the observe method:
recursive?: boolean- Whether to observe changes recursively in subdirectories
Implementation Details
- Full compliance with MDN File System Access API specification
- Support for both user-observable file system and Origin Private File System (OPFS) with
IFileSystemSyncAccessHandle - Proper nullable types for handles based on event types
- Complete JSDoc documentation with MDN references
- Constructor typing enables proper instantiation:
new FileSystemObserver(callback)
These types enable future implementation of file system watching functionality for the watchFile, unwatchFile, and watch methods in FsaNodeFs.
Fixes #1170.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.
@copilot pls