Skip to content

Commit

Permalink
Add explicit return type to deprecated sendEmail function because tsu…
Browse files Browse the repository at this point in the history
…p was complaining
  • Loading branch information
matt-aitken committed Jan 17, 2024
1 parent 4dd6cf1 commit db46f2a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions integrations/resend/src/emails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ import type { ResendRunTask } from "./index";
import { Resend } from "resend";
import { handleResendError } from "./utils";

type SendEmailResult = NonNullable<Awaited<ReturnType<Resend["emails"]["send"]>>["data"]>;
type CreateEmailResult = NonNullable<Awaited<ReturnType<Resend["emails"]["create"]>>["data"]>;
type GetEmailResult = NonNullable<Awaited<ReturnType<Resend["emails"]["get"]>>["data"]>;
export type SendEmailResult = NonNullable<Awaited<ReturnType<Resend["emails"]["send"]>>["data"]>;
export type CreateEmailResult = NonNullable<
Awaited<ReturnType<Resend["emails"]["create"]>>["data"]
>;
export type GetEmailResult = NonNullable<Awaited<ReturnType<Resend["emails"]["get"]>>["data"]>;

export class Emails {
constructor(private runTask: ResendRunTask) {}
Expand Down
4 changes: 2 additions & 2 deletions integrations/resend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
type TriggerIntegration,
} from "@trigger.dev/sdk";
import { Resend as ResendClient } from "resend";
import { Emails } from "./emails";
import { Emails, SendEmailResult } from "./emails";
import { Batch } from "./batch";
import { Contacts } from "./contacts";
import { Audiences } from "./audiences";
Expand Down Expand Up @@ -156,7 +156,7 @@ export class Resend implements TriggerIntegration {
/**
* @deprecated Please use resend.emails.send instead
*/
async sendEmail(...args: Parameters<typeof this.emails.send>) {
async sendEmail(...args: Parameters<typeof this.emails.send>): Promise<SendEmailResult> {
return this.emails.send(...args);
}

Expand Down

0 comments on commit db46f2a

Please sign in to comment.