Skip to content

Commit

Permalink
fix: React types (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
bukinoshita authored Jul 11, 2023
1 parent d2a7f8b commit 4e108cf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/emails/emails.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { render } from '@react-email/render';
import * as React from 'react';
import { Resend } from '../resend';
import {
CreateEmailOptions,
Expand All @@ -22,7 +23,7 @@ export class Emails {
options: CreateEmailRequestOptions = {},
): Promise<CreateEmailResponse> {
if (payload.react) {
payload.html = render(payload.react);
payload.html = render(payload.react as React.ReactElement);
delete payload.react;
}

Expand Down
4 changes: 2 additions & 2 deletions src/emails/interfaces/create-email-options.interface.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ReactElement } from 'react';
import * as React from 'react';
import { PostOptions } from '../../common/interfaces';

interface CreateEmailBaseOptions {
Expand All @@ -7,7 +7,7 @@ interface CreateEmailBaseOptions {
cc?: string | string[];
from: string;
headers?: Record<string, string>;
react?: ReactElement | null;
react?: React.ReactElement | React.ReactNode | null;
reply_to?: string | string[];
subject: string;
tags?: Tag[];
Expand Down
3 changes: 2 additions & 1 deletion src/resend.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 4e108cf

Please sign in to comment.