Repository navigation
fix(inboxes): accept plain strings for inbox label colors - #1155
LauraBeatris merged 3 commits into
Conversation
commit: |
klotty
left a comment
There was a problem hiding this comment.
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
klotty
left a comment
There was a problem hiding this comment.
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
Calling
resend.inboxes.labels.update()orcreate()with a payload built in its own variable fails with TS2345. TypeScript widenscolor: '#E93D82'tostringas soon as it lives in a variable, andstringis 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
InboxLabelColoris nowstring, with a JSDoc line that documents the expected hex formattscif the template literal type comes backTicket: MES-2725
Summary by cubic
Fixes the TypeScript type error (TS2345) when calling
labels.update()orlabels.create()with acolorvalue stored in a variable. TypeScript widenscolor: '#E93D82'tostringoutside inline literals, which isn't assignable to the`#${string}`template literal type.InboxLabelColoris widened tostring, with JSDoc documenting the#RRGGBBformat; the API already validates the hex format and returns a 422, so the template literal offered no extra safety.labels.update().Written for commit cdaecdd. Summary will update on new commits.