clauderic / clauderic/react-sortable-hoc

Incorrect type definition provided for nodes argument in onSortEnd prop

Open
#885 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
10.9k
Forks
959
PR merge metrics
No merged PRs in 30d

Description

According to the type definition, `nodes` of `onSortEnd` is an array of HTMLElement:

https://github.com/clauderic/react-sortable-hoc/blob/caf3c4f5bfb30894639391ae75c1bfc2b707a127/types/index.d.ts#L26-L32

But in reality, to access the HTMLElement, you need to use `nodes[0].node`, which triggers TypeScript error:

```javascript
{
console.log('nodes are', nodes); // {boundingClientRect: null, edgeOffset: null, node: HTMLElement, translate: null}[]

const node = nodes[0].node
console.log('the actual HTML element is', node);
}}
// ...
/>
```

So it looks like either the typedef is wrong, or the code is wrong.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.