diff --git a/.changeset/calm-kids-bake.md b/.changeset/calm-kids-bake.md new file mode 100644 index 0000000..f491bef --- /dev/null +++ b/.changeset/calm-kids-bake.md @@ -0,0 +1,7 @@ +--- +'@reactlit/core': patch +'@reactlit/radix': patch +'@reactlit/vanilla': patch +--- + +Fix to plugin helper type diff --git a/libs/core/src/hooks/use-reactlit.tsx b/libs/core/src/hooks/use-reactlit.tsx index 0db839a..3d8b2b6 100644 --- a/libs/core/src/hooks/use-reactlit.tsx +++ b/libs/core/src/hooks/use-reactlit.tsx @@ -17,16 +17,21 @@ type GenericPluginResult = Plugin extends ReactlitPlugin ? C : never; -type ApplyPlugins = Plugins extends [infer Plugin, ...infer Rest] +type ApplyPlugins = Plugins extends readonly [ + infer Plugin, + ...infer Rest +] ? GenericPluginResult & ApplyPlugins : Record; export type ReactlitFunctionWithPlugins< T extends StateBase, - P extends ReactlitPlugin[] + P extends readonly ReactlitPlugin[] > = ReactlitFunction & ReactlitContext>; -export function useReactlit

[]>(...plugins: P) { +export function useReactlit

[]>( + ...plugins: P +) { return useMemo(() => { function CustomReactlit({ children,