Bug: [react-reconciler] Impossible to import react-reconciler correctly in typescript library without setting esModuleInterop:true in tsconfig. #20327
Labels
Component: Reconciler
Resolution: Stale
Automatically closed due to inactivity
Status: Unconfirmed
A potential issue that we haven't yet confirmed as a bug
React version: not relevant
Steps To Reproduce
react-three-fiber
at this commit pmndrs/react-three-fiber@3e55c9ayarn
to install depsyarn dev
to test changes.The current behavior
I have all consumer typescript projects setup with
esModuleInterop: false
, and then I check types, I check all types including dependencies, I often see warnings about some imports being required to use withesModuleInterop: true
, but enabling the rule to true leads to other unwanted consequences.My last issue was with
react-three-fiber
, do I got it forked, and disabledesModuleInterop
, fixed a lot of types issues until I have stumbled intoreact-reconciler
It is exporting a function as CJS module with
export =
, and I can't import it correctly asimport * as Reconciler from 'react-reconciler
, cos the default can't b function and app is crashing with no TS errors.On other hand, if I
import Reconciler from 'react-reconciler'
, I got no app crashing, but typescript error, and forced to// @ts-ignore
it. It works fine, but looses type safety, and breaks the build for consumers using rollup for build.The expected behavior
Add possibility to
import { Reconciler } from 'react-reconciler'
The text was updated successfully, but these errors were encountered: