-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Description
The types in files/dist/src/index.d.ts appear to be incompatible with React.
function Test() {
return <DraggableList />
}'DraggableList' cannot be used as a JSX component.
Its instance type 'DraggableList<unknown, unknown, Component<Partial<TemplateProps<unknown, unknown>>, {}, any>>' is not a valid JSX element.
The types returned by 'render()' are incompatible between these types.
Type 'Element' is not assignable to type 'ReactNode'.
Property 'children' is missing in type 'Element' but required in type 'ReactPortal'.
This is because on the DraggableList type definition, render() returns JSX.Element.
// node_modules/react-draggable-list/dist/src/index.d.ts
export default class DraggableList<...> extends React.Component<...> {
render(): React.JSX.Element;
}But on React's component types, it returns ReactNode.
// node_modules/@types/react/files/index.d.ts
declare namespace React {
class Component<...> {
render(): ReactNode;
}
}I suggest explicitly defining the return type of render() on src/index.tsx#L566.
- render() {
+ render(): ReactNode {Metadata
Metadata
Assignees
Labels
No labels