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

Incompatible types with types/react v18 #302

Closed
Josh-Cena opened this issue Apr 9, 2022 · 3 comments · Fixed by #303
Closed

Incompatible types with types/react v18 #302

Josh-Cena opened this issue Apr 9, 2022 · 3 comments · Fixed by #303

Comments

@Josh-Cena
Copy link
Contributor

Josh-Cena commented Apr 9, 2022

This issue is a bug report.

Steps to reproduce behavior

  1. Install @types/react@18.0.0
  2. Write some code importing this library:
import React, { type ReactNode } from "react";
import BasicZoom from "react-medium-image-zoom";
import "react-medium-image-zoom/dist/styles.css";

export default function Zoom({ children }: { children: ReactNode }): JSX.Element {
  return <BasicZoom>{children}</BasicZoom>;
}
  1. Run yarn tsc

Expected behavior

This should compile

Actual behavior

../node_modules/react-medium-image-zoom/dist/cjs/Controlled.d.ts(2,43): error TS2305: Module '"react"' has no exported member 'ReactType'.

The problem is that ReactType is removed in v18 in favor of ElementType. See DefinitelyTyped/DefinitelyTyped#56210

We can easily work around this by adding "skipLibCheck": true, but just would like you to know that such an issue exists. Moreover I noticed this lib is still using @types/react@16 and react@16—any plans to upgrade? I can help with the process.

Link to repository/example of behavior

https://github.com/facebook/docusaurus/runs/5952102932?check_suite_focus=true

@rpearce
Copy link
Owner

rpearce commented Apr 9, 2022

I have had plans wax and wane for this project for quite some time, and there are numerous branches that have come and gone with all sorts of upgrades and improvements that never saw the light of day.

I'll take a look at this tonight / tomorrow night if I can!

PRs are also welcome ❤️

@rpearce
Copy link
Owner

rpearce commented Apr 10, 2022

This is released under v4.3.7, and you've been added to the AUTHORS file and All Contributors section in the README.

I'll work on getting the type dev dependencies updated separately.

@Josh-Cena
Copy link
Contributor Author

Great, thanks!

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

Successfully merging a pull request may close this issue.

2 participants