From 96db3913df1c350a6f75c8db72b1e8aec1b081a7 Mon Sep 17 00:00:00 2001 From: S Knutsen Date: Tue, 29 Aug 2023 12:00:00 +0200 Subject: [PATCH] Added missing `models` key to `SubscriberMap` and made actions optional. The `Subscriber` union type of which `SubscriberMap` is a component was missing the optional `models` parameter document here at [#declarative-and-programmatic-usage](https://docs.strapi.io/dev-docs/backend-customization/models#declarative-and-programmatic-usage). I added the optional field by intersecting it with the original type formulation, and also made the `Action` keys optional, since not all of the 18 individual actions should necessarily be specified when making a `SubscriberMap`. --- packages/core/database/lib/lifecycles/subscribers/index.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/core/database/lib/lifecycles/subscribers/index.d.ts b/packages/core/database/lib/lifecycles/subscribers/index.d.ts index be6a7bfc32..8d8e663f12 100644 --- a/packages/core/database/lib/lifecycles/subscribers/index.d.ts +++ b/packages/core/database/lib/lifecycles/subscribers/index.d.ts @@ -3,7 +3,9 @@ import { Event, Action } from '../'; type SubscriberFn = (event: Event) => Promise | void; type SubscriberMap = { - [k in Action]: SubscriberFn; + models?: string[], +} & { + [k in Action]?: SubscriberFn; }; export type Subscriber = SubscriberFn | SubscriberMap;