Skip to content

Conversation

@sethconve
Copy link
Contributor

@sethconve sethconve commented Dec 4, 2025

…cking on sendEmail()


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Summary by CodeRabbit

  • Refactor
    • Template email options updated: template variables are now optional, and the system enforces that template-based sends cannot include plain-text or HTML content to avoid incompatible option combinations.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 4, 2025

Walkthrough

Refines the SendEmailOptions union in src/client/index.ts: makes template.variables optional and adds html?: never and text?: never to the template branch to forbid providing HTML/plain-text when using a template.

Changes

Cohort / File(s) Summary
Type definition refinement
src/client/index.ts
Updated SendEmailOptions type: made template.variables optional (variables?: Record<string, string | number>) and added html?: never and text?: never to the template branch to disallow conflicting content fields.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Confirm html?: never and text?: never are scoped to the template union branch only.
  • Search for callsites that assumed template.variables was required and update typings or usage if needed.

Possibly related PRs

  • Seth/to arrays #49 — Also modifies the template branch of SendEmailOptions; may overlap on template variable requirements.
  • Seth/to arrays #39 — Edits SendEmailOptions (recipient fields); could conflict if combined type changes touch the same union.

Suggested reviewers

  • mikecann
  • ianmacartney

Poem

🐰 I hopped through types with nimble paws,
Made template vars optional, tightened the laws.
No HTML here, nor plain text to fight,
Types sitting cozy, all tidy and bright. ✨📧

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: improving type discrimination for email options to enhance TypeScript checking capabilities.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch seth/templates

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2f0712d and 31b912c.

⛔ Files ignored due to path filters (1)
  • src/component/_generated/component.ts is excluded by !**/_generated/**
📒 Files selected for processing (1)
  • src/client/index.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/client/index.ts

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5f1464e and 2f0712d.

📒 Files selected for processing (1)
  • src/client/index.ts (1 hunks)
🔇 Additional comments (1)
src/client/index.ts (1)

192-193: Excellent type safety improvement.

Adding html?: never and text?: never to the template branch properly enforces mutual exclusivity between template-based and content-based emails at compile time, preventing misuse and runtime errors.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 4, 2025

Open in StackBlitz

npm i https://pkg.pr.new/get-convex/resend/@convex-dev/resend@51

commit: 31b912c

@sethconve sethconve merged commit 4d01652 into main Dec 4, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants