The Wayback Machine - https://web.archive.org/web/20200704192402/https://github.com/mobxjs/mobx-react-lite/issues/263
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

Namespace 'React' has no exported member 'RefForwardingComponent'. #263

Open
RyanChristian4427 opened this issue Mar 12, 2020 · 2 comments · May be fixed by #279
Open

Namespace 'React' has no exported member 'RefForwardingComponent'. #263

RyanChristian4427 opened this issue Mar 12, 2020 · 2 comments · May be fixed by #279

Comments

@RyanChristian4427
Copy link

@RyanChristian4427 RyanChristian4427 commented Mar 12, 2020

Intended outcome

I'm building an application, and after doing some work with MobX, I ran a production build to ensure everything was working as expected, but it errored out. Development build does work exactly as intended, however.

Actual outcome

I get the following error:

✖ ERROR ./node_modules/mobx-react-lite/dist/observer.d.ts
ERROR in ./node_modules/mobx-react-lite/dist/observer.d.ts(5,84):
TS2694: Namespace 'React' has no exported member 'RefForwardingComponent'.

How to reproduce the issue

Creating a simple component will trigger the issue:

export const Example: FunctionalComponent<Issue> = observer((props: Issue) => {
    ...
});

Nothing more advanced than this needed.

Versions

"mobx": "^5.15.4",
"mobx-react-lite": "^1.5.2",
"@types/react": "16.9.19",

Browsing through @types/react, I did notice they deprecated RefForwardingComponent, but even going to an older version (16.9.19) didn't fix this problem. Strangely, if I edit observer.d.ts in node_modules, and import React there (import React from 'react';), the production build works just fine. Just something I noticed.

@FredyC
Copy link
Collaborator

@FredyC FredyC commented Mar 12, 2020

That looks like some issue on your side given that interface is still exported in the latest version.

PR is welcome nonetheless to fix deprecation.

@RyanChristian4427
Copy link
Author

@RyanChristian4427 RyanChristian4427 commented Mar 13, 2020

You're right, it was something in my configuration. Sorry.

@FredyC FredyC reopened this Mar 13, 2020
nulladdict added a commit to nulladdict/mobx-react-lite that referenced this issue Apr 21, 2020
Update react and react-dom types
Use ForwardRefRenderFunction instead of RefForwardingComponent

Closes mobxjs#263
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.