import type * as T from "../_internal/task"; import type { Managed } from "../model"; import { _onExit } from "./onExit"; /** * Ensures that `f` is executed when this Managed is finalized, after * the existing finalizer. * * For usecases that need access to the Managed's result, see [[onExit]]. */ export const ensuring_ = (self: Managed, f: T.Task) => _onExit(self, () => f); /** * Ensures that `f` is executed when this Managed is finalized, after * the existing finalizer. * * For usecases that need access to the Managed's result, see [[onExit]]. */ export const ensuring = (f: T.Task) => (self: Managed) => ensuring_(self, f);