-
-
Notifications
You must be signed in to change notification settings - Fork 638
Fix React import to work with esModuleInterop: false #1946
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
Changes React imports from default import syntax to namespace import
syntax in RSCRoute.tsx and RSCProvider.tsx. This fixes TypeScript
compilation errors when esModuleInterop is set to false in tsconfig.
Before: import React, { ... } from 'react'
After: import * as React from 'react'
This is required because @types/react uses 'export =' syntax, which
can only be default-imported when esModuleInterop is enabled.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
WalkthroughImport statements in two React component files are reorganized by splitting single import lines into separate namespace and named imports. No behavioral or functional changes occur—only module import structure is modified. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used🧠 Learnings (13)📓 Common learnings📚 Learning: 2025-04-26T21:55:55.874ZApplied to files:
📚 Learning: 2025-09-16T08:01:11.146ZApplied to files:
📚 Learning: 2025-07-08T05:57:29.630ZApplied to files:
📚 Learning: 2024-12-12T13:07:09.929ZApplied to files:
📚 Learning: 2025-06-09T07:58:02.646ZApplied to files:
📚 Learning: 2025-02-13T16:50:47.848ZApplied to files:
📚 Learning: 2025-02-13T19:09:15.991ZApplied to files:
📚 Learning: 2025-02-12T16:38:06.537ZApplied to files:
📚 Learning: 2025-02-18T13:08:01.477ZApplied to files:
📚 Learning: 2025-02-18T13:08:01.477ZApplied to files:
📚 Learning: 2025-06-11T12:34:58.182ZApplied to files:
📚 Learning: 2024-10-08T20:53:47.076ZApplied to files:
🔇 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 Review - PR #1946✅ Overall AssessmentThis is a well-executed fix that correctly addresses a TypeScript compilation error. The changes are minimal, targeted, and align with the existing codebase patterns. 🎯 Strengths
📋 Observations
✨ No Issues Found
🚀 RecommendationAPPROVE - This PR is ready to merge. It's a straightforward TypeScript compatibility fix that maintains consistency with the rest of the codebase. 📝 Minor Suggestion (Optional)Consider adding a comment in {
"compilerOptions": {
// Set to false for compatibility with @types/react export = syntax
// Requires namespace imports: import * as React from 'react'
"esModuleInterop": false,
...
}
}But this is a nice-to-have, not a blocker. |
Summary
Fixes TypeScript compilation error in
tests/registerServerComponent.client.test.jsxby changing React imports from default import syntax to namespace import syntax.Changes:
RSCRoute.tsxto useimport * as React from 'react'RSCProvider.tsxto useimport * as React from 'react'Root Cause:
The project's
tsconfig.jsonhasesModuleInterop: false, but@types/reactusesexport =syntax. This combination requires namespace imports (import * as React) rather than default imports (import React).Before:
After:
Test Plan
tests/registerServerComponent.client.test.jsxnow passes🤖 Generated with Claude Code
This change is
Summary by CodeRabbit