Skip to content

fix(inboxes): accept plain strings for inbox label colors - #1155

Merged
LauraBeatris merged 3 commits into
canaryfrom
feature/mes-2725-updating-inbox-label-colors-in-the-sdk-causes-a-type-error
Oct 14, 2026
Merged

LauraBeatris merged 3 commits into
canaryfrom
feature/mes-2725-updating-inbox-label-colors-in-the-sdk-causes-a-type-error

Conversation

@LauraBeatris

@LauraBeatris LauraBeatris commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Calling resend.inboxes.labels.update() or create() with a payload built in its own variable fails with TS2345. TypeScript widens color: '#E93D82' to string as soon as it lives in a variable, and string is not assignable to the template literal type `#${string}`. The same happens for any color read from a database or a form.

The template literal type cannot enforce hex anyway, since '#zzz' satisfies it. The API already validates the format with a regex and returns a 422 with a clear message.

What changed

  • InboxLabelColor is now string, with a JSDoc line that documents the expected hex format
  • Adds a regression test that updates a label from a payload typed as a plain string. It fails tsc if the template literal type comes back

Ticket: MES-2725


Summary by cubic

Fixes the TypeScript type error (TS2345) when calling labels.update() or labels.create() with a color value stored in a variable. TypeScript widens color: '#E93D82' to string outside inline literals, which isn't assignable to the `#${string}` template literal type.

  • InboxLabelColor is widened to string, with JSDoc documenting the #RRGGBB format; the API already validates the hex format and returns a 422, so the template literal offered no extra safety.
  • Adds a regression test that passes a payload typed as a plain string to labels.update().

Written for commit cdaecdd. Summary will update on new commits.

View guided diff

@pkg-pr-new

pkg-pr-new Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/resend@1155

commit: cdaecdd

@klotty klotty left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

cubic analysis

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Linked issue analysis

Linked issue: MES-2725: Updating inbox label colors in the SDK causes a type error

Status Acceptance criteria Notes
✅ Accept plain string colors in label update payloads InboxLabelColor is now string, and the regression test passes a payload with a widened color to update.

Auto-approved: Widens InboxLabelColor from #${string} to plain string with JSDoc, plus a regression test for update() using a variable-typed payload. It is a focused TypeScript fix; runtime API behavior is unchanged and the API already validates hex colors.

View guided diff | Re-trigger cubic

@LauraBeatris LauraBeatris self-assigned this Oct 14, 2026
@LauraBeatris
LauraBeatris marked this pull request as ready for review October 14, 2026 22:07
@LauraBeatris
LauraBeatris requested a review from a team as a code owner October 14, 2026 22:07

@klotty klotty left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

0 issues found across 1 file (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: Widens InboxLabelColor to plain string with JSDoc so colors stored in variables satisfy SDK types; runtime behavior is unchanged and the API already validates hex format. Focused TypeScript fix with a regression test.

View guided diff | Re-trigger cubic

@LauraBeatris
LauraBeatris merged commit e6dff37 into canary Oct 14, 2026
12 checks passed
@LauraBeatris
LauraBeatris deleted the feature/mes-2725-updating-inbox-label-colors-in-the-sdk-causes-a-type-error branch October 14, 2026 22:22
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