I have a TSX file that imports a JSX component in a large code base, sort of like this:
// Foo.tsx
import Bar from 'bar.jsx'
// ...
<Bar
className="red"
>
Hello, world!
</Bar>
// ...
and
const Bar = forwardRef((props, ref) => {
return <div className={props.className}>{props.children}</div>
}
When running my application, I get a large amount of compilation errors like:
TS2322: Type '{ children: (string | Element)[]; className: string; }' is not assignable to type 'IntrinsicAttributes & RefAttributes<any>'. Property 'children' does not exist on type 'IntrinsicAttributes & RefAttributes<any>'.
Unfortunately, its not feasible for me to upgrade all of my jsx components to tsx at this time. So, is there an easy way to configure TS to stop trying to infer types from my unmigrated JSX files and prevent these errors?