diff --git a/.changeset/little-sheep-boil.md b/.changeset/little-sheep-boil.md new file mode 100644 index 0000000000..7b3fd946c1 --- /dev/null +++ b/.changeset/little-sheep-boil.md @@ -0,0 +1,5 @@ +--- +"effect": patch +--- + +remove FnEffect type to improve return type of Effect.fn diff --git a/packages/effect/src/Effect.ts b/packages/effect/src/Effect.ts index 5086dd7a55..88529185f9 100644 --- a/packages/effect/src/Effect.ts +++ b/packages/effect/src/Effect.ts @@ -9783,16 +9783,6 @@ export declare namespace Service { * @category models */ export namespace fn { - /** - * @since 3.11.0 - * @category models - */ - export type FnEffect>> = Effect< - AEff, - [Eff] extends [never] ? never : [Eff] extends [YieldWrap>] ? E : never, - [Eff] extends [never] ? never : [Eff] extends [YieldWrap>] ? R : never - > - /** * @since 3.11.0 * @category models @@ -9800,14 +9790,30 @@ export namespace fn { export type Gen = { >, AEff, Args extends Array>( body: (...args: Args) => Generator - ): (...args: Args) => fn.FnEffect + ): (...args: Args) => Effect< + AEff, + [Eff] extends [never] ? never : [Eff] extends [YieldWrap>] ? E : never, + [Eff] extends [never] ? never : [Eff] extends [YieldWrap>] ? R : never + > >, AEff, Args extends Array, A extends Effect>( body: (...args: Args) => Generator, - a: (_: fn.FnEffect) => A + a: ( + _: Effect< + AEff, + [Eff] extends [never] ? never : [Eff] extends [YieldWrap>] ? E : never, + [Eff] extends [never] ? never : [Eff] extends [YieldWrap>] ? R : never + > + ) => A ): (...args: Args) => A >, AEff, Args extends Array, A, B extends Effect>( body: (...args: Args) => Generator, - a: (_: fn.FnEffect) => A, + a: ( + _: Effect< + AEff, + [Eff] extends [never] ? never : [Eff] extends [YieldWrap>] ? E : never, + [Eff] extends [never] ? never : [Eff] extends [YieldWrap>] ? R : never + > + ) => A, b: (_: A) => B ): (...args: Args) => B < @@ -9819,7 +9825,13 @@ export namespace fn { C extends Effect >( body: (...args: Args) => Generator, - a: (_: fn.FnEffect) => A, + a: ( + _: Effect< + AEff, + [Eff] extends [never] ? never : [Eff] extends [YieldWrap>] ? E : never, + [Eff] extends [never] ? never : [Eff] extends [YieldWrap>] ? R : never + > + ) => A, b: (_: A) => B, c: (_: B) => C ): (...args: Args) => C @@ -9833,7 +9845,13 @@ export namespace fn { D extends Effect >( body: (...args: Args) => Generator, - a: (_: fn.FnEffect) => A, + a: ( + _: Effect< + AEff, + [Eff] extends [never] ? never : [Eff] extends [YieldWrap>] ? E : never, + [Eff] extends [never] ? never : [Eff] extends [YieldWrap>] ? R : never + > + ) => A, b: (_: A) => B, c: (_: B) => C, d: (_: C) => D @@ -9849,7 +9867,13 @@ export namespace fn { E extends Effect >( body: (...args: Args) => Generator, - a: (_: fn.FnEffect) => A, + a: ( + _: Effect< + AEff, + [Eff] extends [never] ? never : [Eff] extends [YieldWrap>] ? E : never, + [Eff] extends [never] ? never : [Eff] extends [YieldWrap>] ? R : never + > + ) => A, b: (_: A) => B, c: (_: B) => C, d: (_: C) => D, @@ -9867,7 +9891,13 @@ export namespace fn { F extends Effect >( body: (...args: Args) => Generator, - a: (_: fn.FnEffect) => A, + a: ( + _: Effect< + AEff, + [Eff] extends [never] ? never : [Eff] extends [YieldWrap>] ? E : never, + [Eff] extends [never] ? never : [Eff] extends [YieldWrap>] ? R : never + > + ) => A, b: (_: A) => B, c: (_: B) => C, d: (_: C) => D, @@ -9887,7 +9917,13 @@ export namespace fn { G extends Effect >( body: (...args: Args) => Generator, - a: (_: fn.FnEffect) => A, + a: ( + _: Effect< + AEff, + [Eff] extends [never] ? never : [Eff] extends [YieldWrap>] ? E : never, + [Eff] extends [never] ? never : [Eff] extends [YieldWrap>] ? R : never + > + ) => A, b: (_: A) => B, c: (_: B) => C, d: (_: C) => D, @@ -9909,7 +9945,13 @@ export namespace fn { H extends Effect >( body: (...args: Args) => Generator, - a: (_: fn.FnEffect) => A, + a: ( + _: Effect< + AEff, + [Eff] extends [never] ? never : [Eff] extends [YieldWrap>] ? E : never, + [Eff] extends [never] ? never : [Eff] extends [YieldWrap>] ? R : never + > + ) => A, b: (_: A) => B, c: (_: B) => C, d: (_: C) => D, @@ -9933,7 +9975,13 @@ export namespace fn { I extends Effect >( body: (...args: Args) => Generator, - a: (_: fn.FnEffect) => A, + a: ( + _: Effect< + AEff, + [Eff] extends [never] ? never : [Eff] extends [YieldWrap>] ? E : never, + [Eff] extends [never] ? never : [Eff] extends [YieldWrap>] ? R : never + > + ) => A, b: (_: A) => B, c: (_: B) => C, d: (_: C) => D,