Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Element' is not assignable to type 'ReactNode'.ts(2322) #315

Open
MudulOzan opened this issue Jun 24, 2022 · 8 comments
Open

Element' is not assignable to type 'ReactNode'.ts(2322) #315

MudulOzan opened this issue Jun 24, 2022 · 8 comments

Comments

@MudulOzan
Copy link

MudulOzan commented Jun 24, 2022

Hi, we have been using reactjs-popup and it worked well so far thanks for the great effort. However, due to the complicated configs of my current project that I am not fond of, giving me strange error while the same code works in another project. I am not quite sure why this is happening and probably not because of this library but I thought I could get some guidance here.

I got this error before and I cloned the project to somewhere else, a different folder and it worked like magic. However I applied the same technique in another project, exactly under the same folder just like I with my previous project that I was getting the same error, it wasn't a successful approach. Now I am stuck with this and I don't want to go ts files and change interface to any. What am I missing?

Version

2.0.5

Test Case

https://codesandbox.io/s/wispy-mountain-m9nfym?file=/src/App.tsx

Expected Behavior

Should not give a type error

Actual Behavior

Here is the error
image
Here is a clean view of the code
code

(property) JSX.IntrinsicElements.button: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>
Type '(close: any) => Element' is not assignable to type 'ReactNode'.ts(2322)
@sammelanyogi
Copy link

I got the same issue

@Xtr102
Copy link

Xtr102 commented Jul 29, 2022

Same here.

@DwaveVito
Copy link

DwaveVito commented Sep 2, 2022

Try this workaround.

螢幕擷取畫面 2022-09-02 113515

@MudulOzan
Copy link
Author

I don't like ignoring ts but thanks anyway

@qaws5503
Copy link

Why is this typescript bug still exists?
My version is: 2.0.5

@pimpawell
Copy link

Try this workaround.

螢幕擷取畫面 2022-09-02 113515

thank

@KieranJamess
Copy link

Try this workaround.

螢幕擷取畫面 2022-09-02 113515

Legend. This has been puzzling me for hours

@AKiranB
Copy link

AKiranB commented May 3, 2024

Try this workaround.

螢幕擷取畫面 2022-09-02 113515

Isn't this just a verbose version of the below?

                {
                    ((close) => (
                      <...Element/>
                    )) as any
                }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants