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

dynamic_template_data not properly documented on typescript MailData and PersonalizationData interfaces #924

Closed
alberto-fp-24 opened this issue May 3, 2019 · 4 comments
Labels
status: duplicate duplicate issue

Comments

@alberto-fp-24
Copy link

alberto-fp-24 commented May 3, 2019

Issue Summary

MailData currently is able to take a dynamic_template_data property, but its interface is missing that field.

In a similar way, PersonalizationData has a field called dynamicTemplateData that, as far as I can tell, does nothing for dynamic templates. However, if we use dynamic_template_data, the templates' handlebar will be properly substituted (but it will raise the same tslint error).

It is probably related to this commit, where dynamicTemplateData should have instead been dynamic_template_data
https://github.com/sendgrid/sendgrid-nodejs/pull/716/files

Steps to Reproduce

  1. Declare a variable of type MailData with a field called dynamic_template_data
const mailOptions: MailData = {
  ...
  dynamic_template_data: {
     hello: "world
  }
}

Expected Behaviour:
tslint shows no error

Actual Behaviour
tslint raises an Object literal may only specify known properties error

Technical details:

"@sendgrid/helpers": "^6.3.0",
"@sendgrid/mail": "^6.3.1",
Node.js Version: v10.15.3
@thinkingserious
Copy link
Contributor

Hi @alberto-fp-24,

We have a deploy on Monday that should resolve this issue. See here for context.

Thank you!

With Best Regards,

Elmer

@okhomenko
Copy link

Still dynamic_template_data doesn't exist on MailData:

/** @type {import('@sendgrid/helpers/classes/mail').MailData} */
    const emailContent = {
      to: toEmail,
      from: this.SG_USER,
      templateId,
      asm: {
        groupId,
      },
      dynamic_template_data: {
        ...body,
        testingHead: debug.head,
        testingBody: debug.body,
      },
      mail_settings: {
        sandbox_mode: {
          enable: sendgridSandboxMode,
        },
      },
    };

Type '{ to: string; from: any; templateId: string; asm: { groupId: number; }; dynamic_template_data: any; mail_settings: { sandbox_mode: { enable: any; }; }; }' is not assignable to type 'MailData'. Object literal may only specify known properties, but 'dynamic_template_data' does not exist in type 'MailData'. Did you mean to write 'dynamicTemplateData'?ts(2322)

@sejr
Copy link

sejr commented Aug 30, 2019

I am seeing this issue as well. @okhomenko were you able to find a fix?

@JefferyHus
Copy link

2021 same issue is still happening

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate duplicate issue
Projects
None yet
Development

No branches or pull requests

5 participants