react-vtree icon indicating copy to clipboard operation
react-vtree copied to clipboard

children type NodeComponentType not exposed for consumption

Open jdmg94 opened this issue 4 years ago • 1 comments

The children prop is typed as NodeComponentProps on TreeProps, however the type is not exported. Only TreeWalker and TreeWalkerValue types get exported from ./Tree as you can see here

In order to properly type my custom tree node component this type should be exposed to the consumer of the library

jdmg94 avatar Oct 08 '21 00:10 jdmg94

for anyone wondering or in need of a work around, I believe this is the equivalent type

import { NodePublicState } from 'react-vtree/dist/es/Tree';
import { ListChildComponentProps } from 'react-window';

type ITreeWalkerData = {
  // This is your data model
}

type TreeNodeComponentProps = Omit<ListChildComponentProps<ITreeWalkerData>, 'index'> & NodePublicState<ITreeWalkerData>

gregjoeval avatar Aug 31 '22 16:08 gregjoeval