@@ -1,6 +1,6 @@
|
||||
/** biome-ignore-all lint/complexity/noBannedTypes: {} is the default type for React props */
|
||||
/** biome-ignore-all lint/complexity/useArrowFunction: necessary for class prototypes */
|
||||
import { Context, type Duration, Effect, Equivalence, ExecutionStrategy, Exit, Fiber, Function, HashMap, identity, Layer, Option, Pipeable, Predicate, Ref, Runtime, Scope, Tracer } from "effect"
|
||||
import { Context, type Duration, Effect, Equivalence, ExecutionStrategy, Exit, Fiber, Function, HashMap, identity, Layer, Option, Pipeable, Predicate, Ref, Scope, Tracer } from "effect"
|
||||
import * as React from "react"
|
||||
|
||||
|
||||
@@ -609,18 +609,18 @@ export const withOptions: {
|
||||
*/
|
||||
export const withRuntime: {
|
||||
<P extends {}, A extends React.ReactNode, E, R, F extends Component.Signature>(
|
||||
context: React.Context<Runtime.Runtime<R>>,
|
||||
context: React.Context<Context.Context<R>>,
|
||||
): (self: Component<P, A, E, Scope.Scope | NoInfer<R>, F>) => F
|
||||
<P extends {}, A extends React.ReactNode, E, R, F extends Component.Signature>(
|
||||
self: Component<P, A, E, Scope.Scope | NoInfer<R>, F>,
|
||||
context: React.Context<Runtime.Runtime<R>>,
|
||||
context: React.Context<Context.Context<R>>,
|
||||
): F
|
||||
} = Function.dual(2, <P extends {}, A extends React.ReactNode, E, R, F extends Component.Signature>(
|
||||
self: Component<P, A, E, R, F>,
|
||||
context: React.Context<Runtime.Runtime<R>>,
|
||||
context: React.Context<Context.Context<R>>,
|
||||
) => function WithRuntime(props: P) {
|
||||
return React.createElement(
|
||||
Runtime.runSync(React.useContext(context))(self.use) as React.FC<P>,
|
||||
Effect.runSyncWith(React.useContext(context))(self.use) as React.FC<P>,
|
||||
props,
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user