Open ErnestoBorio opened 2 years ago
Me too.
Me too.
I had the same issue when the react-draggable was installed in the wrong package in the mono repo. If you're using a mono repo perhaps installing it as a dependency of the right package can help. Could be related. In my case the issue had nothing to do with the package itself.
I solved it this way.
import Draggable from 'react-draggable'; ... const Draggable1: any = Draggable; <Draggable1 ....> ...
@wildwind20001 This means disabling typescript and it means you won't have:
IMHO, it's quite a price to pay for solving this issue locally.
@dht Do you know that times when boss wants to have the app working for yesterday? Well, that. I wonder why is it so difficult that dependencies don't break your project when you didn't even change a thing.
Looks like the root cause of this issue if that many 3rd party libraries do not care about the version of @types/react they require through their dependencies. Now that there's a breaking change in ReactNode declaration between v17 and v18 (v17 allows empty React Fragments, but v18 does not seem to allow them), one has to either apply the trick with type erasure described above, or to patch the v17 type definition like this:
type ReactFragment = Iterable<ReactNode>;
I solved it this way.
import Draggable from 'react-draggable'; ... const Draggable1: any = Draggable; <Draggable1 ....> ...
thanks for the idea! i fixed it like this:
import * as React from "react";
import { Draggable as Draggable1, DraggableProps } from "react-beautiful-dnd";
export const Draggable = Draggable1 as React.ComponentClass<DraggableProps>;
export default Draggable
I get this error while building this Next.js React project
We weren't getting this error before, and the code and the dependencies are the same.
What could be happening?
This is my package.json