-
-
Notifications
You must be signed in to change notification settings - Fork 638
Fix TypeScript error in processPromise return type #2204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
When the promise resolves to a non-ReactElement value (string or ServerRenderHashRenderedHtml), TypeScript couldn't narrow the type properly. Added explicit type assertion since after isValidElement check, the remaining union members are all valid FinalHtmlResult types. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
WalkthroughAdded Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (3)**/*.{rb,js,ts,jsx,tsx,json,yml,yaml,md}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.{js,ts,jsx,tsx,json,css,scss,md}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.{js,ts,jsx,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧠 Learnings (2)📓 Common learnings📚 Learning: 2025-02-13T19:09:15.991ZApplied to files:
🧬 Code graph analysis (1)packages/react-on-rails/src/serverRenderReactComponent.ts (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
🔇 Additional comments (2)
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 |
Code ReviewOverviewThis PR fixes a TypeScript compilation error by adding an explicit type assertion in the ✅ Strengths
🔍 AnalysisWhy TypeScript couldn't narrow the type automatically: The issue occurs because the Why the fix is safe: The logic flow guarantees type safety:
📋 Minor Suggestions (Optional)While the fix is correct, here are some optional considerations:
✅ VerdictApprove with confidence. This is a well-reasoned fix for a TypeScript type narrowing limitation. The type assertion is safe, well-documented, and follows best practices. 🚀 Pre-merge ChecklistPer CLAUDE.md requirements, ensure before merging:
No blocking issues found. ✨ Reviewed by Claude Code following project guidelines in CLAUDE.md |
size-limit report 📦
|
Coalesce all prior beta versions into a single 16.2.0.beta.19 section. Add entries for: - SWC compiler detection improvements (#2135) - TypeScript processPromise return type fix (#2204) - connection_pool 3.0+ compatibility fix (#2125, addressing #2185) Update version headers and comparison links to reflect beta.19.
Coalesce all prior beta versions into a single 16.2.0.beta.19 section. Add entries for: - SWC compiler detection improvements (#2135) - TypeScript processPromise return type fix (#2204) - connection_pool 3.0+ compatibility fix (#2125, addressing #2185) Update version headers and comparison links to reflect beta.19. Also update release script to mention /update-changelog Claude Code command as the preferred option for updating changelogs after a release.
Coalesce all prior beta versions into a single 16.2.0.beta.19 section. Add entries for: - SWC compiler detection improvements (#2135) - TypeScript processPromise return type fix (#2204) - connection_pool 3.0+ compatibility fix (#2125, addressing #2185) Update version headers and comparison links to reflect beta.19. Also update release script to mention /update-changelog Claude Code command as the preferred option for updating changelogs after a release.
### Summary Consolidate all prior beta versions into a single v16.2.0.beta.19 changelog section. This reflects the packages published to npm and RubyGems: - react-on-rails 16.2.0-beta.19 - react-on-rails-pro 16.2.0-beta.19 - react_on_rails 16.2.0.beta.19 - react_on_rails_pro 16.2.0.beta.19 Added new changelog entries for recent fixes since beta.13: - SWC compiler detection improvements (PR #2135) - TypeScript processPromise return type fix (PR #2204) - connection_pool 3.0+ compatibility fix (PR #2125, addressing issue #2185) Also updated the release script's "Next steps" message to mention the `/update-changelog` Claude Code command as the preferred option for updating changelogs after releases. ### Pull Request checklist - [x] Update CHANGELOG file <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **New Features** * Automatic SWC package detection and installation; SWC becomes default for Shakapacker 9.3.0+ with automatic package installation. * **Bug Fixes** * Resolved TypeScript compilation issue. * Fixed compatibility with connection_pool 3.0+. * **Chores** * Version updated to 16.2.0.beta.19. * Changelog references updated. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Summary
serverRenderReactComponent.tsthat was blocking the release scriptisValidElementcheck in the.then()callbackFinalHtmlResultsince after theisValidElementcheck, the remaining types (stringandServerRenderHashRenderedHtml) are all validFinalHtmlResulttypesTest plan
pnpm run type-check)pnpm run build)pnpm run lint)🤖 Generated with Claude Code
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.