From c0fb317b00df20a031be42bb805b4781e5d141e7 Mon Sep 17 00:00:00 2001 From: Jim Fisher Date: Mon, 15 Aug 2022 16:25:18 +0100 Subject: [PATCH 1/2] Issue: types are wrong when calling send() with an array --- packages/mail/src/mail.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mail/src/mail.d.ts b/packages/mail/src/mail.d.ts index fa827498d..d67f15df9 100644 --- a/packages/mail/src/mail.d.ts +++ b/packages/mail/src/mail.d.ts @@ -32,7 +32,7 @@ declare class MailService { /** * Send email */ - send(data: MailDataRequired | MailDataRequired[], isMultiple?: boolean, cb?: (err: Error | ResponseError, result: [ClientResponse, {}]) => void): Promise<[ClientResponse, {}]>; + send(data: MailDataRequired | MailDataRequired[], isMultiple?: boolean, cb?: (err: Error | ResponseError, result: [ClientResponse, {}]) => void): Promise<[ClientResponse, {}] | [ClientResponse, {}][]>; /** * Send multiple emails (shortcut) From 927fce40bdeb6de1864696e18cb05894c58c550c Mon Sep 17 00:00:00 2001 From: Jim Fisher Date: Mon, 15 Aug 2022 16:29:16 +0100 Subject: [PATCH 2/2] More precise: use separate signature for array --- packages/mail/src/mail.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/mail/src/mail.d.ts b/packages/mail/src/mail.d.ts index d67f15df9..1b4dba6f0 100644 --- a/packages/mail/src/mail.d.ts +++ b/packages/mail/src/mail.d.ts @@ -32,7 +32,8 @@ declare class MailService { /** * Send email */ - send(data: MailDataRequired | MailDataRequired[], isMultiple?: boolean, cb?: (err: Error | ResponseError, result: [ClientResponse, {}]) => void): Promise<[ClientResponse, {}] | [ClientResponse, {}][]>; + send(data: MailDataRequired, isMultiple?: boolean, cb?: (err: Error | ResponseError, result: [ClientResponse, {}]) => void): Promise<[ClientResponse, {}]>; + send(data: MailDataRequired[], isMultiple?: boolean, cb?: (err: Error | ResponseError, result: [ClientResponse, {}]) => void): Promise<[ClientResponse, {}][]>; /** * Send multiple emails (shortcut)