-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Closed
Labels
QuestionAn issue which isn't directly actionable in codeAn issue which isn't directly actionable in code
Description
I am trying to figure out type annotation for higher order react components. Here's my code
class A extends React.Component<any, any> {
render() {
return <div>Hello World</div>
}
}
const HigherOrderComponent = (component:any) => {
return class extends component {
render() {
return super.render();
}
};
};
export default HigherOrderComponent(A);
typescript compiler throws following error
Error:(23, 24) TS2507: Type 'any' is not a constructor function type
I tried couple of annotation such as <any, any>, <T extends React.Component<any, any>>. None of them is passing through compilation.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
QuestionAn issue which isn't directly actionable in codeAn issue which isn't directly actionable in code