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
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
"@sendgrid/helpers": "^6.3.0",
"@sendgrid/mail": "^6.3.1",
Node.js Version: v10.15.3
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
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)
I am seeing this issue as well. @okhomenko were you able to find a fix?
2021 same issue is still happening
Most helpful comment
I am seeing this issue as well. @okhomenko were you able to find a fix?