diff --git a/compat/migrations.ts b/compat/migrations.ts index 303cc1c..fac5034 100644 --- a/compat/migrations.ts +++ b/compat/migrations.ts @@ -19,18 +19,18 @@ export interface NoRepeat { export function updateConfig< version extends string, type extends "up" | "down", ->( - fn: (config: T.Config, effects: T.Effects) => T.Config, - configured: boolean, - noRepeat?: NoRepeat, - noFail = false, + >( + fn: (config: T.Config, effects: T.Effects) => T.Config | Promise, + configured: boolean, + noRepeat?: NoRepeat, + noFail = false, ): M.MigrationFn { return M.migrationFn(async (effects: T.Effects) => { await noRepeatGuard(effects, noRepeat, async () => { let config = util.unwrapResultType(await getConfig({})(effects)).config; if (config) { try { - config = fn(config, effects); + config = await fn(config, effects); } catch (e) { if (!noFail) { throw e; @@ -48,10 +48,10 @@ export function updateConfig< export async function noRepeatGuard< version extends string, type extends "up" | "down", ->( - effects: T.Effects, - noRepeat: NoRepeat | undefined, - fn: () => Promise, + >( + effects: T.Effects, + noRepeat: NoRepeat | undefined, + fn: () => Promise, ): Promise { if (!noRepeat) { return fn();