createQueryBuilder<DB>(state?: Partial<InternalState>) has no hooks member, so the widely-documented form is a compile error:
const db = createQueryBuilder<typeof schema>({ schema, meta, hooks: { ... } })
// ~~~~~ TS2353It appears in ~12 files including README.md:164. Two problems compound:
- It does not compile —
TS2353: Object literal may only specify known properties. - The natural workaround,
as any, compiles and then silently never fires the hooks, because hooks are read from the process-wideconfig, not from builder state. Users get a builder that looks configured and quietly ignores every hook.
The second is the harmful one: a silent no-op is worse than the compile error that precedes it.
Fix, in preference order:
- Accept
hooksincreateQueryBuilderand merge it into the config the builder reads, making the documented form true; or - Leave the API as-is and correct the docs to
setConfig({ hooks }), stating explicitly that hooks are process-wide rather than per-builder.
The first matches what the docs have promised for a long time. The second is a one-line docs change but leaves a real ergonomic gap, since per-builder hooks are the reasonable expectation.
Found while auditing after #1001.