Sendgrid-nodejs: 在 typescript MailData 和 PersonalizationData 接口上没有正确记录 dynamic_template_data

创建于 2019-05-03  ·  4评论  ·  资料来源: sendgrid/sendgrid-nodejs

问题摘要

MailData 目前能够采用dynamic_template_data属性,但它的接口缺少该字段。

以类似的方式, PersonalizationData 有一个名为dynamicTemplateData的字段,据我所知,它对动态模板没有任何作用。 但是,如果我们使用dynamic_template_data ,模板的把手将被正确替换(但它会引发相同的 tslint 错误)。

它可能与此提交有关,其中dynamicTemplateData应该改为dynamic_template_data
https://github.com/sendgrid/sendgrid-nodejs/pull/716/files

重现步骤

  1. 使用名为dynamic_template_data的字段声明类型为 MailData 的变量
const mailOptions: MailData = {
  ...
  dynamic_template_data: {
     hello: "world
  }
}

预期行为:
tslint 没有显示错误

实际行为
tslint 引发Object literal may only specify known properties错误

技术细节:

"@sendgrid/helpers": "^6.3.0",
"@sendgrid/mail": "^6.3.1",
Node.js Version: v10.15.3
duplicate

最有用的评论

我也看到了这个问题。 @okhomenko你能找到解决办法吗?

所有4条评论

嗨@alberto-fp-24,

我们周一有一个部署,应该可以解决这个问题。 请参阅此处了解上下文。

谢谢!

最诚挚的问候,

埃尔默

MailData 上仍然不存在 dynamic_template_data:

/** <strong i="6">@type</strong> {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)

我也看到了这个问题。 @okhomenko你能找到解决办法吗?

2021年同样的问题仍在发生

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

danielflippance picture danielflippance  ·  4评论

thinkingserious picture thinkingserious  ·  4评论

Loriot-n picture Loriot-n  ·  4评论

nicoasp picture nicoasp  ·  3评论

murphman300 picture murphman300  ·  4评论