Skip to content

afterChangeHook

afterChangeHook<TCollectionSlug, TDataModel>(slug, fn): (<TDataModel>(props) => void | Promise<void>) | undefined

Defined in: packages/core/src/collections/hooks.ts:167

Types a collection’s afterChange hook against a real collection, DataModel, and resolved CollectionConfig.

TCollectionSlug extends string

TDataModel extends GenericDataModel = GenericDataModel

TCollectionSlug

The collection slug docs/collection should be typed as.

(props) => void | Promise<void>

The hook function, checked against the real types.

(<TDataModel>(props) => void | Promise<void>) | undefined

The same function, re-typed to the collection’s loose public hooks.afterChange signature.

beforeChangeHook