@@ -2,7 +2,7 @@ import { Context, Effect, ExecutionStrategy, Exit, Function, Pipeable, Ref, Runt
|
||||
import * as React from "react"
|
||||
|
||||
|
||||
export interface ReactComponent<E, R, P> extends Pipeable.Pipeable {
|
||||
export interface ReactComponent<E, R, P extends {}> extends Pipeable.Pipeable {
|
||||
(props: P): Effect.Effect<React.ReactNode, E, R>
|
||||
readonly displayName?: string
|
||||
readonly options: Options
|
||||
@@ -26,7 +26,10 @@ export interface MakeOptions {
|
||||
readonly finalizerExecutionStrategy?: ExecutionStrategy.ExecutionStrategy
|
||||
}
|
||||
|
||||
export const make = <Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>, P>(
|
||||
export const make = <
|
||||
Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>,
|
||||
P extends {} = {},
|
||||
>(
|
||||
body: (props: P) => Generator<Eff, React.ReactNode, never>,
|
||||
options?: MakeOptions,
|
||||
): ReactComponent<
|
||||
@@ -55,7 +58,7 @@ export const make = <Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>,
|
||||
|
||||
|
||||
export const useFC: {
|
||||
<E, R, P extends {} = {}>(
|
||||
<E, R, P extends {}>(
|
||||
self: ReactComponent<E, R, P>
|
||||
): Effect.Effect<React.FC<P>, never, Exclude<R, Scope.Scope>>
|
||||
} = Effect.fnUntraced(function* <E, R, P extends {}>(
|
||||
@@ -124,7 +127,7 @@ const closeScope = (
|
||||
|
||||
|
||||
export const use: {
|
||||
<E, R, P extends {} = {}>(
|
||||
<E, R, P extends {}>(
|
||||
self: ReactComponent<E, R, P>,
|
||||
fn: (Component: React.FC<P>) => React.ReactNode,
|
||||
): Effect.Effect<React.ReactNode, never, Exclude<R, Scope.Scope>>
|
||||
@@ -133,10 +136,10 @@ export const use: {
|
||||
})
|
||||
|
||||
export const withRuntime: {
|
||||
<E, R, P extends {} = {}>(
|
||||
<E, R, P extends {}>(
|
||||
context: React.Context<Runtime.Runtime<R>>,
|
||||
): (self: ReactComponent<E, R | Scope.Scope, P>) => React.FC<P>
|
||||
<E, R, P extends {} = {}>(
|
||||
<E, R, P extends {}>(
|
||||
self: ReactComponent<E, R | Scope.Scope, P>,
|
||||
context: React.Context<Runtime.Runtime<R>>,
|
||||
): React.FC<P>
|
||||
|
||||
Reference in New Issue
Block a user