-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[BUG] - Component created from extendVariants
cannot be used as a JSX component
#4269
Comments
@wingkwong I studied the source code of the If I understand everything correctly, the actual declaration of the type ExtendVariants = {
<
C extends JSXElementConstructor<any>,
CP extends ComponentProps<C>,
S extends ComponentSlots<CP>,
V extends ComposeVariants<CP, S>,
SV extends SuggestedVariants<CP, S>,
DV extends DefaultVariants<V, SV>,
CV extends CompoundVariants<V, SV>,
>(
BaseComponent: C,
styles: {
variants?: V;
defaultVariants?: DV;
compoundVariants?: CV;
slots?: S;
},
opts?: Options,
): ForwardRefExoticComponent<
PropsWithoutRef<{
[key in keyof CP | keyof V]?:
| (key extends keyof CP ? CP[key] : never)
| (key extends keyof V ? StringToBoolean<keyof V[key]> : never);
}> &
RefAttributes<ReactElement>
>;
}; |
can you provide a simple sandbox for reproducing the issue and a PR for us to review? |
@wingkwong I will try to do it soon |
@wingkwong Check the reproduction of the error in my codesandbox. In the I also made a pull request #4291 with data type corrections. |
+1, having the same issue |
+1, also does anyone know when will this be released? |
+1, wait for further notification |
also waiting for this release |
+1, having the same issue |
NextUI Version
2.6.4
Describe the bug
As I understand it, due to the change in the
ReactElement
interface in React 19, an error occurs in determining the type of component when creating your own styles through theextendVariants
function.When using
@types/react
version18.3.12
When using
@types/react
version19.0.1
Your Example Website or App
No response
Steps to Reproduce the Bug or Issue
Using these library versions, try to create any component with custom styles through the
extendVariants
function. An error occurs -'Component' cannot be used as a JSX component
.Expected behavior
I think this is an error in the
extendVariants
function type declaration and need to specifyReactElement<any>
there.Screenshots or Videos
No response
Operating System Version
Any
Browser
Chrome
The text was updated successfully, but these errors were encountered: