Commit 1e68434
Fix React import to work with esModuleInterop: false (#1946)
## Summary
Fixes TypeScript compilation error in
`tests/registerServerComponent.client.test.jsx` by changing React
imports from default import syntax to namespace import syntax.
**Changes:**
- Updated `RSCRoute.tsx` to use `import * as React from 'react'`
- Updated `RSCProvider.tsx` to use `import * as React from 'react'`
**Root Cause:**
The project's `tsconfig.json` has `esModuleInterop: false`, but
`@types/react` uses `export =` syntax. This combination requires
namespace imports (`import * as React`) rather than default imports
(`import React`).
**Before:**
```typescript
import React, { Component, use, type ReactNode } from 'react';
```
**After:**
```typescript
import * as React from 'react';
import { Component, use, type ReactNode } from 'react';
```
## Test Plan
- [x] Verified `tests/registerServerComponent.client.test.jsx` now
passes
- [x] Ran all non-RSC tests in react-on-rails-pro package - all passing
- [x] Ran linting checks (ESLint, Prettier, RuboCop) - all passing
- [x] Pre-commit hooks passed automatically
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- Reviewable:start -->
- - -
This change is [<img src="https://reviewable.io/review_button.svg"
height="34" align="absmiddle"
alt="Reviewable"/>](https://reviewable.io/reviews/shakacode/react_on_rails/1946)
<!-- Reviewable:end -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Refactor**
* Internal code organization improvements with no changes to user-facing
functionality or behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Co-authored-by: Claude <[email protected]>1 parent 9cb8915 commit 1e68434
2 files changed
+4
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
0 commit comments