yyllff / split-pane-react

Resizable split panes for React.js.
https://yyllff.github.io/split-pane-react
MIT License
95 stars 25 forks source link

Typescript: Property 'sashRender' is missing in type #12

Open jabidof opened 1 year ago

jabidof commented 1 year ago

Property 'sashRender' is missing in type '{ children: Element[]; sizes: (string | number)[]; onChange: Dispatch<SetStateAction<(string | number)[]>>; }' but required in type 'ISplitProps'.ts(2741)

I suppose you should accept undefined for sashRender. Had to add sashRender={() => null} to make TS accept it.

Thanks for the good job! Nice lib handling the border cases nicely!

yyllff commented 1 year ago

Property 'sashRender' is missing in type '{ children: Element[]; sizes: (string | number)[]; onChange: Dispatch<SetStateAction<(string | number)[]>>; }' but required in type 'ISplitProps'.ts(2741)

I suppose you should accept undefined for sashRender. Had to add sashRender={() => null} to make TS accept it.

Thanks for the good job! Nice lib handling the border cases nicely!

Thank you for your advice. I have a lot to do recently. If you are in a hurry to use it, you can propose a merge, or I will fix the TS problem later next week.

jabidof commented 1 year ago

No hurry... that can be solved anytime soon. I found a fix already but once fixed in TS your library quality will improve 😊

shifenhutu commented 1 year ago

same here

i add the code , it work now:

...
  <SplitPane

          sashRender={(_, active) => (
            <SashContent active={active} type="vscode" />
          )}

        >
...

give a default value to the sashRender