knocklabs / knock-node

Official Node SDK for interacting with the Knock API
MIT License
40 stars 5 forks source link

Typing for workflows.trigger is incorrect #40

Open isaachinman opened 11 months ago

isaachinman commented 11 months ago

Hi there. The TS typings for workflows.trigger are incorrect.

Recipients are marked as optional:

recipients?: (Recipient | RecipientWithUpsert)[];

However, if we trigger workflows without recipients, we get an error:

"The following errors occurred: recipients(required): can't be blank"

Firstly, there are many valid use cases to kick off a workflow without a designated recipient. In our case, these are backoffice support alerts and do not have a dynamic recipient.

Secondly, if recipients truly cannot be blank, the typings should be corrected to prevent valid TS code from throwing errors.