split-pane-react icon indicating copy to clipboard operation
split-pane-react copied to clipboard

TS2322: Type 'Element | undefined' is not assignable to type 'Element'.   Type 'undefined' is not assignable to type 'ReactElement<any, any>'

Open shifenhutu opened this issue 3 years ago • 3 comments

thanks very much for your project

i hope if the currentSelectedTask === undefine , do not render the second <Pane>

but i got a ts error: TS2322: Type 'Element | undefined' is not assignable to type 'Element'.   Type 'undefined' is not assignable to type 'ReactElement<any, any>

image

shifenhutu avatar Dec 20 '22 09:12 shifenhutu

if i change my code to this:

 {currentSelectedTask !== undefined ? (
            <Pane className={"pane"}> pane 222</Pane>
          ) : (
            <></>
          )}

its work, but , it has two pane in the dom:

image

shifenhutu avatar Dec 20 '22 09:12 shifenhutu

maybe we need to let the SplitPane children support null

shifenhutu avatar Dec 20 '22 10:12 shifenhutu

maybe we need to let the SplitPane children support null

最近有点忙,你有时间可以修复一下,然后提一个merge request。我得忙完了这阵才有精力看这个问题。

yyllff avatar Dec 20 '22 12:12 yyllff