Skip to content

Commit

Permalink
fix(system-rsc): extendVariants typescript type (#4291)
Browse files Browse the repository at this point in the history
* fix: ReactElement type

* fix: extendVariants forwardRef return type

* feat: add changeset

* chore(changeset): change to patch

---------

Co-authored-by: աӄա <wingkwong.code@gmail.com>
  • Loading branch information
2 people authored and macci001 committed Dec 17, 2024
1 parent d9a55d0 commit 1b2553a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/twelve-ducks-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nextui-org/system-rsc": patch
---

Fix data type returned by the extendVariants function (#4269)
16 changes: 11 additions & 5 deletions packages/core/system-rsc/src/extend-variants.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import type {ClassValue, StringToBoolean, OmitUndefined, ClassProp} from "tailwind-variants";
import type {ForwardRefRenderFunction, JSXElementConstructor, ReactElement} from "react";
import type {
ForwardRefExoticComponent,
JSXElementConstructor,
PropsWithoutRef,
ReactElement,
RefAttributes,
} from "react";

type SlotsClassValue<S> = {
[K in keyof S]?: ClassValue;
Expand Down Expand Up @@ -90,13 +96,13 @@ export type ExtendVariants = {
slots?: S;
},
opts?: Options,
): ForwardRefRenderFunction<
ReactElement,
{
): 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>
>;
};

Expand Down

0 comments on commit 1b2553a

Please sign in to comment.