diff --git a/packages/mail/src/mail.d.ts b/packages/mail/src/mail.d.ts index 86ed84220..058b5642f 100644 --- a/packages/mail/src/mail.d.ts +++ b/packages/mail/src/mail.d.ts @@ -1,7 +1,9 @@ -import Client = require("@sendgrid/client"); import {ClientResponse} from "@sendgrid/client/src/response"; import {ResponseError} from "@sendgrid/helpers/classes"; -import {MailData} from "@sendgrid/helpers/classes/mail"; +import {MailContent, MailData} from "@sendgrid/helpers/classes/mail"; + +type MailDataRequired = MailData & ( + { text: string } | { html: string } | { content: MailContent[] & { 0: MailContent } }); declare class MailService { /** @@ -17,18 +19,18 @@ declare class MailService { /** * Send email */ - send(data: MailData, 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 emails */ - send(data: MailData[], 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) */ - sendMultiple(data: MailData, cb?: (error: Error|ResponseError, result: [ClientResponse, {}]) => void): Promise<[ClientResponse, {}]>; + sendMultiple(data: MailDataRequired, cb?: (error: Error | ResponseError, result: [ClientResponse, {}]) => void): Promise<[ClientResponse, {}]>; } -declare const mail: MailService & { MailService: typeof MailService } +declare const mail: MailService & { MailService: typeof MailService }; export = mail