improvement(utils): adopt toRecord and toRecordOrNull over inline record coercions - #8053
Merged
Merged
Conversation
…gh toRecord The first pass matched one operand order, so six exact equivalents written `x !== null && typeof x === 'object'` survived — two of them beside a sibling the pass had already deleted. Domain-named wrappers keep their names and delegate, matching the microsoft-teams client that already did.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 102 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@sim/utils/objectalready exportedtoRecord(v)(isRecordLike(v) ? v : {}) andtoRecordOrNull(v)(… : null). This adopts them at the 117 inline sites that spelled those shapes out by handasRecord,record,objectValue,asObject) across harmonic, quickbooks, sim-setup, onepassword ×2, cbinsights, instantly, bitbucket ×2, google-drive, jira, slack and the slack-custom-ingress inline copy, repointing their importersasObject, google-driveasObject, jiraasObject, slackrecord) keep their names and delegate their bodies, matching the microsoft-teams client that already did thisRecord<string, unknown>Deliberately left alone: 5 sites of the form
isRecordLike(data) ? data.prop : null, where the tested and returned expressions differ —toRecord(data).propwould yieldundefinedrather thannull. Also out of scope, and a candidate for a follow-up: ~33 negated guard prologues (if (!v || typeof v !== 'object' || Array.isArray(v)) return null) that each carry anas Record<string, unknown>cast the helper would remove.Type of Change
Testing
bun run type-checkclean in apps/sim, apps/desktop, apps/realtime, packages/{utils,emcn,sim-cli,sim-setup}bun run lint,check:audits(47/47),test:scripts(351), block-registry check anddocs-manifest:checkall passChecklist
🤖 Generated with Claude Code