Skip to content
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

Bug: [react-reconciler] Impossible to import react-reconciler correctly in typescript library without setting esModuleInterop:true in tsconfig. #20327

Closed
JustFly1984 opened this issue Nov 24, 2020 · 3 comments
Labels
Component: Reconciler Resolution: Stale Automatically closed due to inactivity Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug

Comments

@JustFly1984
Copy link

JustFly1984 commented Nov 24, 2020

React version: not relevant

Steps To Reproduce

  1. fork react-three-fiber at this commit pmndrs/react-three-fiber@3e55c9a
  2. run yarn to install deps
  3. open src/renderer.tsx
  4. run yarn 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 with esModuleInterop: 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 disabled esModuleInterop, fixed a lot of types issues until I have stumbled into react-reconciler

It is exporting a function as CJS module with export =, and I can't import it correctly as import * 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'

@JustFly1984 JustFly1984 added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Nov 24, 2020
@ffind
Copy link

ffind commented Mar 3, 2023

Issue is still valid

Copy link

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

@github-actions github-actions bot added the Resolution: Stale Automatically closed due to inactivity label Apr 10, 2024
Copy link

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Reconciler Resolution: Stale Automatically closed due to inactivity Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug
Projects
None yet
Development

No branches or pull requests

3 participants