ref: Reuse isObjectLike for object guards - #25058
Conversation
Co-Authored-By: OpenAI Codex <codex@openai.com>
size-limit report 📦
|
isObjectLike for object guards
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 42b71f5. Configure here.
| if (p === 'router' && typeof newValue === 'object' && newValue !== null) { | ||
| patchRouter(client, newValue, currentRouterPatchingNavigationSpanRef); | ||
| if (p === 'router' && isObjectLike(newValue)) { | ||
| patchRouter(client, newValue as unknown as NextRouter, currentRouterPatchingNavigationSpanRef); |
There was a problem hiding this comment.
Uncommented double cast on router
Low Severity
A new as unknown as NextRouter double-cast was added without a comment explaining why a safer typing is not possible. I flagged this because the review rules require every new double-cast in SDK source to include that justification.
Triggered by project rule: PR Review Guidelines for Cursor Bot
Reviewed by Cursor Bugbot for commit 42b71f5. Configure here.
There was a problem hiding this comment.
was any before, we keep the assumption that Next assign a NextRouter here.


Reuse the existing
isObjectLikehelper for repeated non-null object guards across SDK packages. It checks the same runtime condition and narrows unknown values, allowing redundant type assertions to be removed without changing behavior.