diff --git a/src/emails/emails.ts b/src/emails/emails.ts index 269ef88d..d4ab5363 100644 --- a/src/emails/emails.ts +++ b/src/emails/emails.ts @@ -1,4 +1,5 @@ import { render } from '@react-email/render'; +import * as React from 'react'; import { Resend } from '../resend'; import { CreateEmailOptions, @@ -22,7 +23,7 @@ export class Emails { options: CreateEmailRequestOptions = {}, ): Promise { if (payload.react) { - payload.html = render(payload.react); + payload.html = render(payload.react as React.ReactElement); delete payload.react; } diff --git a/src/emails/interfaces/create-email-options.interface.ts b/src/emails/interfaces/create-email-options.interface.ts index 73042a79..09585bf5 100644 --- a/src/emails/interfaces/create-email-options.interface.ts +++ b/src/emails/interfaces/create-email-options.interface.ts @@ -1,4 +1,4 @@ -import { ReactElement } from 'react'; +import * as React from 'react'; import { PostOptions } from '../../common/interfaces'; interface CreateEmailBaseOptions { @@ -7,7 +7,7 @@ interface CreateEmailBaseOptions { cc?: string | string[]; from: string; headers?: Record; - react?: ReactElement | null; + react?: React.ReactElement | React.ReactNode | null; reply_to?: string | string[]; subject: string; tags?: Tag[]; diff --git a/src/resend.ts b/src/resend.ts index ee9450b1..4f69bfd9 100644 --- a/src/resend.ts +++ b/src/resend.ts @@ -1,4 +1,5 @@ import axios, { AxiosInstance, AxiosResponse } from 'axios'; +import * as React from 'react'; import { render } from '@react-email/render'; import { version } from '../package.json'; import { GetOptions, PostOptions, PutOptions } from './common/interfaces'; @@ -115,7 +116,7 @@ export class Resend { const path = `${this.baseUrl}/email`; if (data.react) { - data.html = render(data.react); + data.html = render(data.react as React.ReactElement); delete data.react; }