property WatchSession.fileWatchers

The live fs.watch handles keyed by watched path — unstable, and a PARTIAL view: the parent-directory watchers, rescan intervals and symlink pollers the session also owns are not in here. It answers "what is being watched", not "every handle the watcher holds".

The record is the watcher's own object, so it reflects additions and removals as they happen. After close() the handles in it are closed but the keys remain.

import type { WatchSession } from './watch.ts';

// Defined, not invoked: needs a live session.
function watchedPaths(session: WatchSession) {
  return Object.keys(session.fileWatchers);
}

Type

Record<string, FSWatcher>

Usage

import { type WatchSession } from "lib/api/watch.ts";