Skip to content

Commit db1978b

Browse files
justin808claude
andcommitted
Fix TypeScript import error for React in RSC files
Changed from: import React, { createContext } from 'react' To: import * as React from 'react' import { createContext } from 'react' This fixes the CI error: error TS1259: Module can only be default-imported using the 'esModuleInterop' flag The @types/react package uses 'export =' syntax, which requires namespace imports unless esModuleInterop is enabled. Using separate imports avoids this requirement. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 6f6364a commit db1978b

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)