SortableJS / react-sortablejs

React bindings for SortableJS
http://sortablejs.github.io/react-sortablejs/
MIT License
2.04k stars 210 forks source link

[bug] Missing children prop #233

Closed j-schumann closed 2 years ago

j-schumann commented 2 years ago

Describe the bug Please add children as explicit property for <ReactSortable>. Using react-sortable together with @types/react at version ^18 (but React@17) throws:

Type error: Type '{ children: Element[]; list: ItemInterface[]; setList: Dispatch<SetStateAction<ItemInterface[]>>; animation: number; delay: number; onSort: () => void; disabled: boolean; group: string; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<ReactSortable<ItemInterface>> & Pick<Readonly<ReactSortableProps<ItemInterface>>, never> & Partial<...> & Partial<...>'.
  Property 'children' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<ReactSortable<ItemInterface>> & Pick<Readonly<ReactSortableProps<ItemInterface>>, never> & Partial<...> & Partial<...>'.

Reason here: https://solverfox.dev/writing/no-implicit-children/

Expected behavior children added to ReactSortableProps / no compile error

Information react-sortable = ^6.1.1 react = ^17.0.2