diff --git a/packages/effect-fc/src/Form.ts b/packages/effect-fc/src/Form.ts index 4b02a7b..adc8eb9 100644 --- a/packages/effect-fc/src/Form.ts +++ b/packages/effect-fc/src/Form.ts @@ -160,8 +160,8 @@ export const submit = ( > => Effect.whenEffect( self.valueRef.pipe( Effect.andThen(identity), - Effect.andThen(value => Result.forkEffect( - self.onSubmit(value) as Effect.Effect>, + Effect.andThen(value => Result.unsafeForkEffect( + self.onSubmit(value), { initialProgress: self.initialSubmitProgress }, )), Effect.andThen(([sub]) => Effect.all([Effect.succeed(sub), sub.get])), diff --git a/packages/effect-fc/src/Result.ts b/packages/effect-fc/src/Result.ts index b54153e..465662a 100644 --- a/packages/effect-fc/src/Result.ts +++ b/packages/effect-fc/src/Result.ts @@ -186,22 +186,21 @@ export const makeProgressLayer = (): Layer.Layer< })) -export namespace forkEffect { - export type InputContext = R extends Progress ? [X] extends [P] ? R : never : R - export type OutputContext = Scope.Scope | Exclude | Progress> +export namespace unsafeForkEffect { + export type OutputContext = Scope.Scope | Exclude | Progress

> export interface Options

{ readonly initialProgress?: P } } -export const forkEffect = ( - effect: Effect.Effect>>, - options?: forkEffect.Options

, +export const unsafeForkEffect = ( + effect: Effect.Effect, + options?: unsafeForkEffect.Options

, ): Effect.Effect< readonly [result: Subscribable.Subscribable, never, never>, fiber: Fiber.Fiber], never, - Scope.Scope | forkEffect.OutputContext + Scope.Scope | unsafeForkEffect.OutputContext > => Effect.Do.pipe( Effect.bind("ref", () => Ref.make>(initial())), Effect.bind("pubsub", () => PubSub.unbounded>()), @@ -231,8 +230,21 @@ export const forkEffect = ( }), fiber, ]), -) as Effect.Effect< - readonly [result: Subscribable.Subscribable, never, never>, fiber: Fiber.Fiber], - never, - Scope.Scope | forkEffect.OutputContext -> +) + +export namespace forkEffect { + export type InputContext = R extends Progress ? [X] extends [P] ? R : never : R + export type OutputContext = unsafeForkEffect.OutputContext + export interface Options

extends unsafeForkEffect.Options

{} +} + +export const forkEffect: { + ( + effect: Effect.Effect>>, + options?: forkEffect.Options

, + ): Effect.Effect< + readonly [result: Subscribable.Subscribable, never, never>, fiber: Fiber.Fiber], + never, + Scope.Scope | forkEffect.OutputContext + > +} = unsafeForkEffect