From 626a9292d5c73c0c65f7b9740c70ab471d65ba83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Valverd=C3=A9?= Date: Wed, 29 Oct 2025 15:07:49 +0100 Subject: [PATCH] Fix forkEffectScoped --- packages/effect-fc/src/Result.ts | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/packages/effect-fc/src/Result.ts b/packages/effect-fc/src/Result.ts index 2ea70fa..c9bddc9 100644 --- a/packages/effect-fc/src/Result.ts +++ b/packages/effect-fc/src/Result.ts @@ -178,7 +178,7 @@ export const makeProgressLayer = ( export namespace forkEffectScoped { - export type ContextInput = (R extends Progress + export type InputContext = (R extends Progress ? [X] extends [P] ? R : never @@ -188,15 +188,17 @@ export namespace forkEffectScoped { export interface Options

{ readonly initialProgress?: P } + + export type OutputContext = Scope.Scope | Exclude | Progress> } export const forkEffectScoped = ( - effect: Effect.Effect>>, + effect: Effect.Effect>>, options?: forkEffectScoped.Options

, ): Effect.Effect< Queue.Dequeue>, never, - Scope.Scope | Exclude> + forkEffectScoped.OutputContext > => Effect.Do.pipe( Effect.bind("queue", () => Queue.unbounded>()), Effect.bind("ref", () => Ref.make>(initial())), @@ -218,12 +220,4 @@ export const forkEffectScoped = ( ) )), Effect.map(({ queue }) => queue), -) - - -const t = forkEffectScoped( - Effect.gen(function*() { - yield* Progress() - }), - { initialProgress: "juif" } -) +) as Effect.Effect>, never, Scope.Scope>