I’m getting this error in a simple react component:
Type ‘Element’ is not assignable to type ‘ReactNode’.
Also, I noticed that for some reason the attribute “className” is supposedly deprecated.
The onClick attribute thows the next error:
Type ‘{ children: string; onClick: () => void; }’ is not assignable to type ‘HtmlButtonTag’. Property ‘onClick’ does not exist on type ‘HtmlButtonTag’. Did you mean ‘onclick’?
Environment:
-
Bun version 1.1.20
-
React ^18.3.1
-
React-dom ^18.3.1
-
@types/react ^18.3.3
-
@types/react-dom ^18.3.0
Sorry for my bad English.
I tried changing “React.ReactNode” to “JSX.Element” and the error changes to:
Type ‘import(“c:/Users/[user]/projects/[project]/node_modules/@types/react/jsx-runtime”).JSX.Element’ is not assignable to type ‘JSX.Element’.
When I remove the function return type, the return error gone, but className and onClick errors still appear.