Closed Cutshadows closed 2 years ago
we are facing the same error .
Same here. As a workaround I did this:
import WrongSwitch from 'react-switch';
const Switch = WrongSwitch as any; // TS has an issue with the return type
Not ideal but it's just one extra line 🤷
this is crazy but i installed the same package with npm and i dont see error. But i installed with Yarn and errors appeared with JSX.
I applied recommendation line with Yarn environment. I have "good result". Thanks.
errors also appeared in these libraries react-spring, react-tooltip
` declare class ReactSwitch extends React.Component< ReactSwitchProps & allowedHTMLinputProps
{ return (
<>
{
children.map((child, i, arr)=>{
if (i + 1 === arr.length) return child
return {child}
})
}
</>
);
}
export default ReactSwitch;
`
I implemented this line of code in the library that is in node_modules and it was solved.
Maybe this will help. See link.
add ts-ignore:
{/// @ts-ignore /}
Dark Mode:
If you're reporting a bug or incorrect behavior, please include:
The OS and browser where the bug is encountered
A link to sandbox where the bug can be reproduced (fork this sandbox)
Steps to reproduce the bug
https://stackblitz.com/edit/react-ts-wtvvz3?file=index.tsx