fix(core): tolerate minimal FSWatcher typings (#35264)

This commit is contained in:
Kit Langton
2026-07-03 22:37:42 -04:00
committed by GitHub
parent 35ed09ff37
commit e2faeb84e5
+5 -3
View File
@@ -89,9 +89,11 @@ const layer = Layer.effect(
type: "update",
} satisfies Update)
})
subscription.on("error", (error) =>
Effect.runFork(Effect.logError("watcher callback failed", { path: target, error })),
)
if ("on" in subscription && typeof subscription.on === "function") {
subscription.on("error", (error: unknown) =>
Effect.runFork(Effect.logError("watcher callback failed", { path: target, error })),
)
}
return { unsubscribe: () => Promise.resolve(subscription.close()) }
})
: subscribeDirectory(native, backend, directory, ignore, pubsub)