docs: add spread example to entriesFromList#1559
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds a second example to the entriesFromList API documentation to demonstrate that the returned entries object can be spread into an object({...}) definition alongside manually defined entries, not only passed as the sole argument.
Changes:
- Added an additional
entriesFromListexample using object-literal spread insidev.object({ ... }).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thank you! |
commit: |
See https://x.com/i/status/2079192795328454926
Summary
Add an example to the
entriesFromListAPI docs showing its result can be spread intoobjectalongside other manually defined entries, not just passed as the sole argument.Reasoning
Spreading
entriesFromListinline avoids repeating the shared schema for every key, without needing an extra named variable either:Real World Example
See hyunbinseo/better-surf@9fd74e7
Alternatives Considered
###subheadings (one example per use case, likeobject's "Merge several objects" pattern) — dropped in favor of a single compact example, since the two snippets are just variants of the same idea rather than distinct scenarios.ObjectSchema1/ObjectSchema2, matching the "merge several objects" convention) — replaced withObjectSchema/ObjectSchemaWithSpreadfor clarity, since here both schemas are fully declared rather than referenced placeholders.Summary by CodeRabbit
entriesFromListdocumentation with an example showing how to spread its result into an object schema.