While this solution functions, its effectiveness may vary.
// Bar.jsx
import * as React from 'react';
/**
* @type {{ new(props: any): {
props: { x: string, y: number },
state: any,
context: any,
refs: any,
render: any,
setState: any,
forceUpdate: any
} }}
*/
const Bar = class Bar extends React.Component {
render() {
return <div className={this.props.x}>{this.props.y}</div>;
}
};
export default Bar;
// import Bar and utilize it in .tsx or .jsx file
import Bar from './Bar';
<Bar/>; // error: Type '{}' is not assignable to type '{ x: string; y: number; }'
<Bar x='x' y={0}/>; // OK