react-arborist
react-arborist copied to clipboard
Property 'select' does not exist on type 'never'
trafficstars
Hi first of all thanks for a fantastic component!
I have a problem with the type definitions when using the useRef example.
So the following code bellow produces the error Property 'select' does not exist on type 'never' on the tree.select statement. I tried defining the tree component type but couldn't figure out what it is.
function App() {
const treeRef = useRef();
useEffect(() => {
const tree = treeRef.current;
if (tree) {
tree.select("1");
}
}, []);
return <Tree initialData={data} ref={treeRef} />;
}
Aww man, that's annoying. @ts-ignore 🙊
What version of TS are you running?
Try useRef<TreeApi<T> | undefined> where T is the type of the data being supplied to the Tree component's data property.