Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing typing #1280

Open
assertnotnull opened this issue Jun 16, 2021 · 2 comments
Open

Confusing typing #1280

assertnotnull opened this issue Jun 16, 2021 · 2 comments
Labels
status: help wanted requesting help from the community type: bug bug in the library

Comments

@assertnotnull
Copy link

The API for Node JS is confusing and not aligned with the API:

  • there's MailData.text & html but there's also MailData.content which is not optional when using MailData. The two first are not in the API doc but content 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 call send with Mail or MailJSON.

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.

@thinkingserious
Copy link
Contributor

Hello @assertnotnull,

Great catch! When using dynamic transactional templates, we don't need to set the content values. I believe the change will need to be implemented here.

This issue has been added to our internal backlog to be prioritized. Pull requests and +1s on the issue summary will help it move up the backlog.

With best regards,

Elmer

@thinkingserious thinkingserious added status: help wanted requesting help from the community type: bug bug in the library labels Jun 18, 2021
@acomito
Copy link

acomito commented May 10, 2022

This was confusing to me as well. Seems to still be in there? I'm getting an error if I don't pass in a content field

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: help wanted requesting help from the community type: bug bug in the library
Projects
None yet
Development

No branches or pull requests

3 participants