I'm looking for a way to declare a React component extending existing component with my own props in Typescript. The source component is ReactD3Tree from react-d3-tree npm package v2.0.0. So I have:
import ReactD3Tree from "react-d3-tree";
import { TreeProps } from "react-d3-tree/lib/Tree/types";
import { RawNodeDatum } from "react-d3-tree/lib/types/common";
interface MyNode extends RawNodeDatum {
// some properties
}
interface MyProps extends TreeProps {
onNodeClick: (targetNode: MyNode, event: Event) => any;
}
let MyTree: React.ComponentClass<MyProps>;
const MyComponentWithOtherOperations = () => {
...some more code here enter code here
return <MyTree data={data} onNodeClick={handleNodeClick} />
}
My question is how do I properly override onNodeClick prop of ReactD3Tree that accepts targetNode: RawNodeDatum as a parameter? I want to have targetNode: MyNode as a parameter where MyNode extends RaNodeDatum Thanks in advance
ReactD3Tree?onNodeClickmethod which accepts a node as a parameter. I want to have my custom node there.