From 5f34ea8df5bdb52f2b7931c56aebc43bee173d23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Valverd=C3=A9?= Date: Mon, 21 Jul 2025 01:46:13 +0200 Subject: [PATCH] Work --- packages/effect-fc/src/Component.ts | 46 ++++++++++++++--------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/packages/effect-fc/src/Component.ts b/packages/effect-fc/src/Component.ts index 7e6d4a2..3b484f2 100644 --- a/packages/effect-fc/src/Component.ts +++ b/packages/effect-fc/src/Component.ts @@ -328,29 +328,6 @@ export const withOptions: { Object.getPrototypeOf(self), )) -export const withRuntime: { - , R>( - context: React.Context>, - ): (self: T) => React.FC & SuspenseProps - : Component.Props - > - ( - self: Component & Suspense, - context: React.Context>, - ): React.FC

- ( - self: Component, - context: React.Context>, - ): React.FC

-} = Function.dual(2, ( - self: Component, - context: React.Context>, -): React.FC

=> function WithRuntime(props) { - const runtime = React.useContext(context) - return React.createElement(Runtime.runSync(runtime)(useFC(self)), props) -}) - export interface Memoized

{ readonly memo: true @@ -403,6 +380,29 @@ export const suspense = , P extends {}>( ) +export const withRuntime: { + , R>( + context: React.Context>, + ): (self: T) => React.FC & SuspenseProps + : Component.Props + > + ( + self: Component & Suspense, + context: React.Context>, + ): React.FC

+ ( + self: Component, + context: React.Context>, + ): React.FC

+} = Function.dual(2, ( + self: Component, + context: React.Context>, +): React.FC

=> function WithRuntime(props) { + const runtime = React.useContext(context) + return React.createElement(Runtime.runSync(runtime)(useFC(self)), props) +}) + export const useFC: { ( self: Component & Suspense