fix: require in TS at least 1 type of content for sending mail by childish-sambino · Pull Request #1041 · sendgrid/sendgrid-nodejs · GitHub
Skip to content

fix: require in TS at least 1 type of content for sending mail#1041

Merged
childish-sambino merged 1 commit into
masterfrom
ts-send
Feb 21, 2020
Merged

fix: require in TS at least 1 type of content for sending mail#1041
childish-sambino merged 1 commit into
masterfrom
ts-send

Conversation

@childish-sambino

Copy link
Copy Markdown
Contributor

Fixes #978

@thinkingserious thinkingserious added the status: code review request requesting a community code review or review from Twilio label Feb 14, 2020
@childish-sambino childish-sambino merged commit ce5707a into master Feb 21, 2020
@thinkingserious

Copy link
Copy Markdown
Contributor

@JClackett

Copy link
Copy Markdown

This has introduced a TS error when sending mails with just templateIds:

const data = {
	from: "someemail",
    to: "somemail",
    templateId: "some sendgrid templateId",
    dynamic_template_data: {randonVariables: "something"},
}

sendgrid.send(data)
Property 'content' is missing in type '{ from: string; to: string | string[]; templateId: string; dynamic_template_data: any; }' but required in type '{ content: MailContent[] & { 0: MailContent; }; }'.

We dont require there to be a body or content as its using a template?

Any ideas?

@childish-sambino

Copy link
Copy Markdown
Contributor Author

🤦‍♂ Need more |s.

@krazibit

krazibit commented Mar 9, 2020

Copy link
Copy Markdown

as @JClackett mentioned, template use case was not included.
anyone working to add the type union in the MailDataRequired already?

@childish-sambino

Copy link
Copy Markdown
Contributor Author

@krazibit It was included as part of #1053

@krazibit

krazibit commented Mar 9, 2020

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: code review request requesting a community code review or review from Twilio

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeScript types allow mails with missing bodies

5 participants