fix(api): dispatch optional data-first calls - #113
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 38dfcbb The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
b95d32b to
d379506
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The predicate-based dual dispatch fixes the reported runtime misbehavior and is backed by focused regression tests covering both data-first and data-last usage.
Pull request overview
Restores correct runtime behavior for Effect dual APIs when called data-first with omitted optional trailing arguments, aligning runtime return values with the published overloads for Box and Renderer.
Changes:
- Switch
dualimplementations forBox.border,Box.pad,Renderer.render, andRenderer.renderLinesToStringfrom fixed arity to runtime input predicates to properly detect data-first calls. - Add regression tests covering omitted/supplied options for both data-first and piped (data-last) forms.
- Add a patch changeset documenting the fix.
File summaries
| File | Description |
|---|---|
| packages/effect-boxes/tests/optional-data-first.test.ts | Adds regression coverage for optional data-first calls and ensures data-last piping remains intact. |
| packages/effect-boxes/src/internal/renderer.ts | Updates dual dispatch for render and renderLinesToString to use runtime predicates. |
| packages/effect-boxes/src/internal/box.ts | Updates dual dispatch for border and pad to use runtime predicates. |
| .changeset/floppy-birds-battle.md | Documents the patch-level behavior fix for optional data-first calls. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
d379506 to
38dfcbb
Compare
Goal and scope
Restore the advertised data-first behavior for dual APIs with optional trailing arguments. Data-last calls must remain unchanged.
Description
Uses runtime input predicates for Box padding, borders, and Renderer helpers instead of treating optional arguments as required arity.
How to test
bun run --cwd packages/effect-boxes test tests/optional-data-first.test.ts.Review
Closes #94