From 6677844eec54ae7e5a3ff3a1bb5eafef9df4a2ba Mon Sep 17 00:00:00 2001 From: James Ritchie Date: Sun, 7 Sep 2025 15:38:02 +0100 Subject: [PATCH] Fixes typescript errors --- .../emails/src/transports/aws-ses.ts | 28 +++++++++---------- .../emails/src/transports/smtp.ts | 2 +- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/internal-packages/emails/src/transports/aws-ses.ts b/internal-packages/emails/src/transports/aws-ses.ts index 58a136e1d..0ae3e04de 100644 --- a/internal-packages/emails/src/transports/aws-ses.ts +++ b/internal-packages/emails/src/transports/aws-ses.ts @@ -1,37 +1,36 @@ import { render } from "@react-email/render"; import { EmailError, MailMessage, MailTransport, PlainTextMailMessage } from "./index"; -import nodemailer from "nodemailer" -import * as awsSes from "@aws-sdk/client-ses" +import nodemailer from "nodemailer"; +import * as awsSes from "@aws-sdk/client-ses"; export type AwsSesMailTransportOptions = { - type: 'aws-ses', -} + type: "aws-ses"; +}; export class AwsSesMailTransport implements MailTransport { #client: nodemailer.Transporter; constructor(options: AwsSesMailTransportOptions) { - const ses = new awsSes.SESClient() + const ses = new awsSes.SESClient(); this.#client = nodemailer.createTransport({ SES: { aws: awsSes, - ses - } - }) + ses, + }, + }); } - async send({to, from, replyTo, subject, react}: MailMessage): Promise { + async send({ to, from, replyTo, subject, react }: MailMessage): Promise { try { await this.#client.sendMail({ from: from, to, replyTo: replyTo, subject, - html: render(react), + html: await render(react), }); - } - catch (error) { + } catch (error) { if (error instanceof Error) { console.error( `Failed to send email to ${to}, ${subject}. Error ${error.name}: ${error.message}` @@ -43,7 +42,7 @@ export class AwsSesMailTransport implements MailTransport { } } - async sendPlainText({to, from, replyTo, subject, text}: PlainTextMailMessage): Promise { + async sendPlainText({ to, from, replyTo, subject, text }: PlainTextMailMessage): Promise { try { await this.#client.sendMail({ from: from, @@ -52,8 +51,7 @@ export class AwsSesMailTransport implements MailTransport { subject, text: text, }); - } - catch (error) { + } catch (error) { if (error instanceof Error) { console.error( `Failed to send email to ${to}, ${subject}. Error ${error.name}: ${error.message}` diff --git a/internal-packages/emails/src/transports/smtp.ts b/internal-packages/emails/src/transports/smtp.ts index 5dfd1dec5..d38465697 100644 --- a/internal-packages/emails/src/transports/smtp.ts +++ b/internal-packages/emails/src/transports/smtp.ts @@ -29,7 +29,7 @@ export class SmtpMailTransport implements MailTransport { to, replyTo: replyTo, subject, - html: render(react), + html: await render(react), }); } catch (error) { if (error instanceof Error) {