tomkp / react-split-pane

React split-pane component
https://tomkp.github.io/react-split-pane
MIT License
3.2k stars 409 forks source link

Type Error #829

Closed lewismazzei closed 2 years ago

lewismazzei commented 2 years ago

Hi! πŸ‘‹

Firstly, thanks for your work on this project! πŸ™‚

Today I used patch-package to patch react-split-pane@0.1.92 for the project I'm working on.

I got the following error in my IDE and when running npm run build:

Type error: Type '{ children: Element[]; split: "vertical"; minSize: number; defaultSize: number; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<SplitPane> & Pick<Readonly<SplitPaneProps>, never> & InexactPartial<...> & InexactPartial<...>'.
  Property 'children' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<SplitPane> & Pick<Readonly<SplitPaneProps>, never> & InexactPartial<...> & InexactPartial<...>'.

   7 | const Home: NextPage = () => {
   8 |   return (
>  9 |     <SplitPane split='vertical' minSize={50} defaultSize={100}>
     |      ^
  10 |       <div />
  11 |       <div />
  12 |     </SplitPane>

Here is the diff that solved my problem:

diff --git a/node_modules/react-split-pane/index.d.ts b/node_modules/react-split-pane/index.d.ts
index d116f54..5701a2c 100644
--- a/node_modules/react-split-pane/index.d.ts
+++ b/node_modules/react-split-pane/index.d.ts
@@ -5,6 +5,7 @@ export type Size = string | number;
 export type Split = 'vertical' | 'horizontal';

 export type SplitPaneProps = {
+  children: React.ReactElement[],
   allowResize?: boolean;
   className?: string;
   primary?: 'first' | 'second';

This issue body was partially generated by patch-package.