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 'JSX' #203

Open
kaiyoma opened this issue May 16, 2023 · 3 comments
Open

Namespace 'React' has no exported member 'JSX' #203

kaiyoma opened this issue May 16, 2023 · 3 comments

Comments

@kaiyoma
Copy link

kaiyoma commented May 16, 2023

Version 3.5.1 is throwing a type error from inside node_modules:

../../common/temp/node_modules/.pnpm/rc-virtual-list@3.5.1_sfoxds7t5ydpegc3knd667wn6m/node_modules/rc-virtual-list/lib/List.d.ts:38:89 - error TS2694: Namespace 'React' has no exported member 'JSX'.

38 export declare function RawList<T>(props: ListProps<T>, ref: React.Ref<ListRef>): React.JSX.Element;
                                                                                           ~~~

../../common/temp/node_modules/.pnpm/rc-virtual-list@3.5.1_sfoxds7t5ydpegc3knd667wn6m/node_modules/rc-virtual-list/lib/ScrollBar.d.ts:42:21 - error TS2694: Namespace 'React' has no exported member 'JSX'.

42     render(): React.JSX.Element;
                       ~~~


Found 2 errors in 2 files.

Errors  Files
     1  ../../common/temp/node_modules/.pnpm/rc-virtual-list@3.5.1_sfoxds7t5ydpegc3knd667wn6m/node_modules/rc-virtual-list/lib/List.d.ts:38
     1  ../../common/temp/node_modules/.pnpm/rc-virtual-list@3.5.1_sfoxds7t5ydpegc3knd667wn6m/node_modules/rc-virtual-list/lib/ScrollBar.d.ts:42
@kaiyoma
Copy link
Author

kaiyoma commented May 16, 2023

I believe this problem was introduced in 3.5.0 in this commit: 1ff9e16

If I forcibly downgrade to version 3.4.13, the type error goes away.

Even though this package claims that it supports any React version in its peer dependencies, it's using a very new version of @types/react, which works only with React 18. We're using React 17 in our project, so that's why we're seeing this error. Seems like either the version of @types/react should be downgraded/reverted, or the peer dependencies should be updated to reflect reality.

@kaiyoma
Copy link
Author

kaiyoma commented May 29, 2023

Also see react-component/tree#746.

@ethaizone
Copy link

It happen because this changed.
DefinitelyTyped/DefinitelyTyped@f1b2559

I'm not sure if this can help but you might try to add this in your package.json.

  "resolutions": {
    "@types/react": "^18.2.12"
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants