Skip to content

@iamcalegari/mongoat / HookFn

Type Alias: HookFn<Ctx>

HookFn<Ctx> = (ctx) => void | unknown | Promise<void | unknown>

Defined in: src/types/hooks.ts:35

A hook function invoked with an explicit ctx object. Sync or async; the return value convention differs between pre and post hooks:

  • pre hooks: return value is ignored (mutate ctx in place instead).
  • post hooks: undefined observes only; any other value transforms ctx.result (opt-in via return).

Type Parameters

Ctx

Ctx

Parameters

ctx

Ctx

Returns

void | unknown | Promise<void | unknown>