Sendgrid-nodejs: dynamic_template_data auf den Typoskript-MailData- und PersonalizationData-Schnittstellen nicht richtig dokumentiert

Erstellt am 3. Mai 2019  ·  4Kommentare  ·  Quelle: sendgrid/sendgrid-nodejs

Problemzusammenfassung

MailData kann derzeit eine dynamic_template_data Eigenschaft annehmen, aber in der Schnittstelle fehlt dieses Feld.

Auf ähnliche Weise hat PersonalizationData ein Feld namens dynamicTemplateData , das, soweit ich das beurteilen kann, nichts für dynamische Vorlagen tut. Wenn wir jedoch dynamic_template_data , wird die Handlebar der Templates korrekt ersetzt (aber es wird der gleiche Tslint-Fehler ausgelöst).

Es hängt wahrscheinlich mit diesem Commit zusammen, wobei dynamicTemplateData stattdessen dynamic_template_data
https://github.com/sendgrid/sendgrid-nodejs/pull/716/files

Schritte zum Reproduzieren

  1. Deklarieren Sie eine Variable vom Typ MailData mit einem Feld namens dynamic_template_data
const mailOptions: MailData = {
  ...
  dynamic_template_data: {
     hello: "world
  }
}

Erwartetes Verhalten:
tslint zeigt keinen Fehler an

Tatsächliches Verhalten
tslint löst einen Object literal may only specify known properties Fehler aus

Technische Details:

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

Hilfreichster Kommentar

Ich sehe dieses Problem auch. @okhomenko konntest du eine Lösung finden?

Alle 4 Kommentare

Hallo @alberto-fp-24,

Wir haben am Montag eine Bereitstellung, die dieses Problem beheben sollte. Siehe hier für Kontext.

Dankeschön!

Mit besten Empfehlungen,

Elmer

Dynamic_template_data existiert immer noch nicht auf MailData:

/** <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)

Ich sehe dieses Problem auch. @okhomenko konntest du eine Lösung finden?

2021 tritt das gleiche Problem immer noch auf

War diese Seite hilfreich?
0 / 5 - 0 Bewertungen

Verwandte Themen

thinkingserious picture thinkingserious  ·  4Kommentare

thinkingserious picture thinkingserious  ·  4Kommentare

polkhovsky picture polkhovsky  ·  3Kommentare

Loriot-n picture Loriot-n  ·  4Kommentare

amlcodes picture amlcodes  ·  4Kommentare