-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: update email interface and email sending test
- Loading branch information
1 parent
fc3696c
commit 31bafb8
Showing
3 changed files
with
11 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 6 additions & 10 deletions
16
examples/common_nestjs_remix/apps/api/src/common/emails/email.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,9 @@ | ||
interface BaseEmail { | ||
export type Email = { | ||
to: string; | ||
from: string; | ||
subject: string; | ||
} | ||
|
||
type RequireAtLeastOne<T> = { | ||
[K in keyof T]-?: Required<Pick<T, K>> & | ||
Partial<Pick<T, Exclude<keyof T, K>>>; | ||
}[keyof T]; | ||
|
||
export type Email = RequireAtLeastOne<{ text: string; html: string }> & | ||
BaseEmail; | ||
} & ( | ||
| { html: string; text?: never } | ||
| { text: string; html?: never } | ||
| { text: string; html: string } | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters