Skip to content

Commit

Permalink
fix: Types (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
bukinoshita authored Jul 11, 2023
1 parent 50b96ac commit 5922ace
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"homepage": "https://github.com/resend-inc/resend-node#readme",
"dependencies": {
"@react-email/render": "0.0.7",
"axios": "1.4.0"
"axios": "1.4.0",
"type-fest": "3.13.0"
},
"devDependencies": {
"@types/jest": "29.5.3",
Expand Down
20 changes: 7 additions & 13 deletions src/emails/interfaces/create-email-options.interface.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import { PostOptions } from '../../common/interfaces';
import { RequireAtLeastOne } from 'type-fest';

interface CreateEmailBaseOptions {
attachments?: Attachment[];
Expand All @@ -8,25 +9,18 @@ interface CreateEmailBaseOptions {
from: string;
headers?: Record<string, string>;
react?: React.ReactElement | React.ReactNode | null;
html?: string;
text?: string;
reply_to?: string | string[];
subject: string;
tags?: Tag[];
to: string | string[];
}

interface CreateEmailWithHtmlOptions extends CreateEmailBaseOptions {
html: string;
text?: string;
}

interface CreateEmailWithTextOptions extends CreateEmailBaseOptions {
html?: string;
text: string;
}

export type CreateEmailOptions =
| CreateEmailWithHtmlOptions
| CreateEmailWithTextOptions;
export type CreateEmailOptions = RequireAtLeastOne<
CreateEmailBaseOptions,
'react' | 'html' | 'text'
>;

export interface CreateEmailRequestOptions extends PostOptions {}

Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2743,6 +2743,11 @@ type-detect@4.0.8:
resolved "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz"
integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==

type-fest@3.13.0:
version "3.13.0"
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-3.13.0.tgz#b088347ae73779a750c461694b264340c4c8c0d7"
integrity sha512-Gur3yQGM9qiLNs0KPP7LPgeRbio2QTt4xXouobMCarR0/wyW3F+F/+OWwshg3NG0Adon7uQfSZBpB46NfhoF1A==

type-fest@^0.21.3:
version "0.21.3"
resolved "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz"
Expand Down

0 comments on commit 5922ace

Please sign in to comment.