Skip to content

Commit ba964a1

Browse files
justin808claude
andcommitted
Fix React import to work with esModuleInterop: false
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]>
1 parent 21ca217 commit ba964a1

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

packages/react-on-rails-pro/src/RSCProvider.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414

1515
'use client';
1616

17-
import React, { createContext, useContext, type ReactNode } from 'react';
17+
import * as React from 'react';
18+
import { createContext, useContext, type ReactNode } from 'react';
1819
import type { ClientGetReactServerComponentProps } from './getReactServerComponent.client.ts';
1920
import { createRSCPayloadKey } from './utils.ts';
2021

packages/react-on-rails-pro/src/RSCRoute.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616

1717
'use client';
1818

19-
import React, { Component, use, type ReactNode } from 'react';
19+
import * as React from 'react';
20+
import { Component, use, type ReactNode } from 'react';
2021
import { useRSC } from './RSCProvider.tsx';
2122
import { ServerComponentFetchError } from './ServerComponentFetchError.ts';
2223

0 commit comments

Comments
 (0)