structor icon indicating copy to clipboard operation
structor copied to clipboard

TypeScript support

Open nosferatu500 opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

https://github.com/nosferatu500/react-sortable-tree/releases/tag/v4.0.0

nosferatu500 avatar Nov 12 '21 08:11 nosferatu500

@nosferatu500 thanks for the new version heads-up! We use typescript, so I upgraded to v4.0.0. However, it seems that the path types (path, nextPath, prevPath, ...) are set to number[] in the typings, while the documentation states that these can be number[] or string[]:

Generate an object with additional props to be passed to the node renderer. Use this for adding buttons via the buttons key, or additional style / className settings. ({ node: object, path: number[] or string[], treeIndex: number, lowerSiblingCounts: number[], isSearchMatch: bool, isSearchFocus: bool }): object

type GenerateNodePropsParams = {
  node: any
  path: number[]
  treeIndex: number
  lowerSiblingCounts: number[]
  isSearchMatch: boolean
  isSearchFocus: boolean
}

mgunnerud avatar Nov 15 '21 10:11 mgunnerud