sendgrid-nodejs
sendgrid-nodejs copied to clipboard
Confusing typing
The API for Node JS is confusing and not aligned with the API:
- there's
MailData.text
&html
but there's alsoMailData.content
which is not optional when usingMailData
. The two first are not in the API doc butcontent
is https://sendgrid.com/docs/api-reference/ - Readme mentions internal classe
Mail
that seems like an option to use but then the typing is not aligned with anything in the documentation. Typescript says you can't callsend
withMail
orMailJSON
.
The current version forces me to set:
content: [
{ type: 'text/plain', value: '' },
{ type: 'text/html', value: '' },
],
So it's valid Typescript even though we use template ids and values.