export type ChangeHandler = (changedFiles: string[]) => void; export type ErrorHandler = (err: Error) => void; export declare class FileWatcher { private rootPath; private onChange; private watchers; private watchedDirs; private watchedDirInodes; private pendingFiles; private flushTimer; private debounceMs; private onError; constructor(rootPath: string, onChange: ChangeHandler, debounceMs?: number, onError?: ErrorHandler); start(): Promise; stop(): void; private scheduleFlush; private watchDir; /** * Attach a watcher to a directory created after start(). Called from the * per-directory change callback with every event path; stats the path and * only recurses when it is a genuinely new, watchable directory. */ private watchNewDir; /** * Forget a deleted directory and everything watched beneath it. fs.watch * emits no per-descendant events on a recursive delete, so the whole * prefix must be purged here for a recreate to re-watch the full subtree. */ private unwatchSubtree; }