This commit is contained in:
@@ -26,14 +26,7 @@ const nonReactiveTags = [Tracer.ParentSpan] as const
|
||||
|
||||
|
||||
export namespace make {
|
||||
export interface Options {
|
||||
readonly untraced?: boolean
|
||||
readonly finalizerExecutionMode?: "sync" | "fork"
|
||||
readonly finalizerExecutionStrategy?: ExecutionStrategy.ExecutionStrategy
|
||||
}
|
||||
}
|
||||
|
||||
export const make: {
|
||||
export type Gen = {
|
||||
<Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>, P extends {} = {}>(
|
||||
body: (props: P) => Generator<Eff, React.ReactNode, never>,
|
||||
): Component<
|
||||
@@ -176,7 +169,16 @@ export const make: {
|
||||
h: (_: G, props: NoInfer<P>) => H,
|
||||
i: (_: H, props: NoInfer<P>) => Effect.Effect<React.ReactNode, EOut, ROut>,
|
||||
): Component<EOut, ROut, P>
|
||||
} = (...pipeables: readonly [any]) => {
|
||||
}
|
||||
|
||||
export interface Options {
|
||||
readonly untraced?: boolean
|
||||
readonly finalizerExecutionMode?: "sync" | "fork"
|
||||
readonly finalizerExecutionStrategy?: ExecutionStrategy.ExecutionStrategy
|
||||
}
|
||||
}
|
||||
|
||||
export const make: make.Gen = (...pipeables: readonly [any]) => {
|
||||
const displayName: string = !String.isEmpty(pipeables[0].name) ? pipeables[0].name : undefined
|
||||
|
||||
return Object.setPrototypeOf({
|
||||
@@ -187,30 +189,10 @@ export const make: {
|
||||
}, ComponentProto)
|
||||
}
|
||||
|
||||
export const make_old = <
|
||||
Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>,
|
||||
P extends {} = {},
|
||||
>(
|
||||
body: (props: P) => Generator<Eff, React.ReactNode, never>,
|
||||
options?: make.Options,
|
||||
): Component<
|
||||
[Eff] extends [never] ? never : [Eff] extends [Utils.YieldWrap<Effect.Effect<infer _A, infer E, infer _R>>] ? E : never,
|
||||
[Eff] extends [never] ? never : [Eff] extends [Utils.YieldWrap<Effect.Effect<infer _A, infer _E, infer R>>] ? R : never,
|
||||
P
|
||||
> => {
|
||||
const displayName = !String.isEmpty(body.name) ? body.name : undefined
|
||||
|
||||
return Object.setPrototypeOf({
|
||||
body: options?.untraced
|
||||
? Effect.fnUntraced(body)
|
||||
: displayName
|
||||
? Effect.fn(displayName)(body)
|
||||
: Effect.fn(body),
|
||||
displayName,
|
||||
finalizerExecutionMode: options?.finalizerExecutionMode ?? "sync",
|
||||
finalizerExecutionStrategy: options?.finalizerExecutionStrategy ?? ExecutionStrategy.sequential,
|
||||
}, ComponentProto)
|
||||
}
|
||||
export const makeUntraced: make.Gen = (...pipeables: readonly [any]) => Object.setPrototypeOf({
|
||||
body: Effect.fnUntraced(...pipeables),
|
||||
displayName: !String.isEmpty(pipeables[0].name) ? pipeables[0].name : undefined,
|
||||
}, ComponentProto)
|
||||
|
||||
|
||||
export const withRuntime: {
|
||||
|
||||
Reference in New Issue
Block a user