import * as T from "../../../base/lib/types" export type UninstallFn = (opts: { effects: T.Effects }) => Promise export class Uninstall { private constructor(readonly fn: UninstallFn) {} static of(fn: UninstallFn) { return new Uninstall(fn) } async uninstall({ effects, nextVersion, }: Parameters[0]) { if (!nextVersion) await this.fn({ effects, }) } } export function setupUninstall( fn: UninstallFn, ) { return Uninstall.of(fn) }