DB Docs
API Reference
- Core API Reference
- Collection
- createCollection
- liveQueryCollectionOptions
- createLiveQueryCollection
- createOptimisticAction
- createTransaction
- Electric DB Collection
- electricCollectionOptions
- Query DB Collection
- queryCollectionOptions
- RxDB DB Collection
- rxdbCollectionOptions
- PowerSync Collection
- powerSyncCollectionOptions
- createIndexedDB
- indexedDBCollectionOptions
- React Hooks
- useLiveQuery
AI/LLM: This documentation page is available in plain markdown format at/db/latest/docs/reference/type-aliases/CleanupFn.md
CleanupFn
ts
type CleanupFn = () => void | () => Promise<void>;Defined in: packages/db/src/types.ts:415
Ends one sync run and releases its adapter-owned resources.
Collection cleanup waits for a returned promise before publishing the cleaned-up status or admitting a replacement sync run. TypeScript permits Promise-returning functions where () => void is expected, so the Promise branch must be explicit here to preserve and await it. Keeping the callable types separate also preserves contextual-void callbacks that return an incidental value.