diff --git a/packages/effect-fc/src/Component.ts b/packages/effect-fc/src/Component.ts index d120975..1ac25c1 100644 --- a/packages/effect-fc/src/Component.ts +++ b/packages/effect-fc/src/Component.ts @@ -244,81 +244,81 @@ export namespace make { } export type NonGen = { - // , P extends {} = {}>( - // body: (props: P) => Eff - // ): Component, Effect.Effect.Context> - // , A, P extends {} = {}>( - // body: (props: P) => A, - // a: (_: A, props: NoInfer

) => Eff, - // ): Component, Effect.Effect.Context> - // , A, B, P extends {} = {}>( - // body: (props: P) => A, - // a: (_: A, props: NoInfer

) => B, - // b: (_: B, props: NoInfer

) => Eff, - // ): Component, Effect.Effect.Context> - // , A, B, C, P extends {} = {}>( - // body: (props: P) => A, - // a: (_: A, props: NoInfer

) => B, - // b: (_: B, props: NoInfer

) => C, - // c: (_: C, props: NoInfer

) => Eff, - // ): Component, Effect.Effect.Context> - // , A, B, C, D, P extends {} = {}>( - // body: (props: P) => A, - // a: (_: A, props: NoInfer

) => B, - // b: (_: B, props: NoInfer

) => C, - // c: (_: C, props: NoInfer

) => D, - // d: (_: D, props: NoInfer

) => Eff, - // ): Component, Effect.Effect.Context> - // , A, B, C, D, E, P extends {} = {}>( - // body: (props: P) => A, - // a: (_: A, props: NoInfer

) => B, - // b: (_: B, props: NoInfer

) => C, - // c: (_: C, props: NoInfer

) => D, - // d: (_: D, props: NoInfer

) => E, - // e: (_: E, props: NoInfer

) => Eff, - // ): Component, Effect.Effect.Context> - // , A, B, C, D, E, F, P extends {} = {}>( - // body: (props: P) => A, - // a: (_: A, props: NoInfer

) => B, - // b: (_: B, props: NoInfer

) => C, - // c: (_: C, props: NoInfer

) => D, - // d: (_: D, props: NoInfer

) => E, - // e: (_: E, props: NoInfer

) => F, - // f: (_: F, props: NoInfer

) => Eff, - // ): Component, Effect.Effect.Context> - // , A, B, C, D, E, F, G, P extends {} = {}>( - // body: (props: P) => A, - // a: (_: A, props: NoInfer

) => B, - // b: (_: B, props: NoInfer

) => C, - // c: (_: C, props: NoInfer

) => D, - // d: (_: D, props: NoInfer

) => E, - // e: (_: E, props: NoInfer

) => F, - // f: (_: F, props: NoInfer

) => G, - // g: (_: G, props: NoInfer

) => Eff, - // ): Component, Effect.Effect.Context> - // , A, B, C, D, E, F, G, H, P extends {} = {}>( - // body: (props: P) => A, - // a: (_: A, props: NoInfer

) => B, - // b: (_: B, props: NoInfer

) => C, - // c: (_: C, props: NoInfer

) => D, - // d: (_: D, props: NoInfer

) => E, - // e: (_: E, props: NoInfer

) => F, - // f: (_: F, props: NoInfer

) => G, - // g: (_: G, props: NoInfer

) => H, - // h: (_: H, props: NoInfer

) => Eff, - // ): Component, Effect.Effect.Context> - // , A, B, C, D, E, F, G, H, I, P extends {} = {}>( - // body: (props: P) => A, - // a: (_: A, props: NoInfer

) => B, - // b: (_: B, props: NoInfer

) => C, - // c: (_: C, props: NoInfer

) => D, - // d: (_: D, props: NoInfer

) => E, - // e: (_: E, props: NoInfer

) => F, - // f: (_: F, props: NoInfer

) => G, - // g: (_: G, props: NoInfer

) => H, - // h: (_: H, props: NoInfer

) => I, - // i: (_: I, props: NoInfer

) => Eff, - // ): Component, Effect.Effect.Context> + , P extends {} = {}>( + body: (props: P) => Eff + ): Component>, Effect.Effect.Error, Effect.Effect.Context> + , A, P extends {} = {}>( + body: (props: P) => A, + a: (_: A, props: NoInfer

) => Eff, + ): Component>, Effect.Effect.Error, Effect.Effect.Context> + , A, B, P extends {} = {}>( + body: (props: P) => A, + a: (_: A, props: NoInfer

) => B, + b: (_: B, props: NoInfer

) => Eff, + ): Component>, Effect.Effect.Error, Effect.Effect.Context> + , A, B, C, P extends {} = {}>( + body: (props: P) => A, + a: (_: A, props: NoInfer

) => B, + b: (_: B, props: NoInfer

) => C, + c: (_: C, props: NoInfer

) => Eff, + ): Component>, Effect.Effect.Error, Effect.Effect.Context> + , A, B, C, D, P extends {} = {}>( + body: (props: P) => A, + a: (_: A, props: NoInfer

) => B, + b: (_: B, props: NoInfer

) => C, + c: (_: C, props: NoInfer

) => D, + d: (_: D, props: NoInfer

) => Eff, + ): Component>, Effect.Effect.Error, Effect.Effect.Context> + , A, B, C, D, E, P extends {} = {}>( + body: (props: P) => A, + a: (_: A, props: NoInfer

) => B, + b: (_: B, props: NoInfer

) => C, + c: (_: C, props: NoInfer

) => D, + d: (_: D, props: NoInfer

) => E, + e: (_: E, props: NoInfer

) => Eff, + ): Component>, Effect.Effect.Error, Effect.Effect.Context> + , A, B, C, D, E, F, P extends {} = {}>( + body: (props: P) => A, + a: (_: A, props: NoInfer

) => B, + b: (_: B, props: NoInfer

) => C, + c: (_: C, props: NoInfer

) => D, + d: (_: D, props: NoInfer

) => E, + e: (_: E, props: NoInfer

) => F, + f: (_: F, props: NoInfer

) => Eff, + ): Component>, Effect.Effect.Error, Effect.Effect.Context> + , A, B, C, D, E, F, G, P extends {} = {}>( + body: (props: P) => A, + a: (_: A, props: NoInfer

) => B, + b: (_: B, props: NoInfer

) => C, + c: (_: C, props: NoInfer

) => D, + d: (_: D, props: NoInfer

) => E, + e: (_: E, props: NoInfer

) => F, + f: (_: F, props: NoInfer

) => G, + g: (_: G, props: NoInfer

) => Eff, + ): Component>, Effect.Effect.Error, Effect.Effect.Context> + , A, B, C, D, E, F, G, H, P extends {} = {}>( + body: (props: P) => A, + a: (_: A, props: NoInfer

) => B, + b: (_: B, props: NoInfer

) => C, + c: (_: C, props: NoInfer

) => D, + d: (_: D, props: NoInfer

) => E, + e: (_: E, props: NoInfer

) => F, + f: (_: F, props: NoInfer

) => G, + g: (_: G, props: NoInfer

) => H, + h: (_: H, props: NoInfer

) => Eff, + ): Component>, Effect.Effect.Error, Effect.Effect.Context> + , A, B, C, D, E, F, G, H, I, P extends {} = {}>( + body: (props: P) => A, + a: (_: A, props: NoInfer

) => B, + b: (_: B, props: NoInfer

) => C, + c: (_: C, props: NoInfer

) => D, + d: (_: D, props: NoInfer

) => E, + e: (_: E, props: NoInfer

) => F, + f: (_: F, props: NoInfer

) => G, + g: (_: G, props: NoInfer

) => H, + h: (_: H, props: NoInfer

) => I, + i: (_: I, props: NoInfer

) => Eff, + ): Component>, Effect.Effect.Error, Effect.Effect.Context> } } diff --git a/packages/example/src/routes/index.tsx b/packages/example/src/routes/index.tsx index 6ccf8a8..82c5e35 100644 --- a/packages/example/src/routes/index.tsx +++ b/packages/example/src/routes/index.tsx @@ -4,18 +4,21 @@ import { TodosState } from "@/todo/TodosState.service" import { createFileRoute } from "@tanstack/react-router" import { Effect } from "effect" import { Component } from "effect-fc" -import { Hooks } from "effect-fc/hooks" +import { useContext } from "effect-fc/hooks" const TodosStateLive = TodosState.Default("todos") -export const Route = createFileRoute("/")({ - component: Component.makeUntraced(function* Index() { - return yield* Todos.pipe( - Effect.map(FC => ), - Effect.provide(yield* Hooks.useContext(TodosStateLive, { finalizerExecutionMode: "fork" })), - ) - }).pipe( - Component.withRuntime(runtime.context) +const Index = Component.makeUntraced(function* Index() { + const context = yield* useContext(TodosStateLive, { finalizerExecutionMode: "fork" }) + return yield* Todos.pipe( + Effect.map(F => ), + Effect.provide(context), ) +}).pipe( + Component.withRuntime(runtime.context) +) + +export const Route = createFileRoute("/")({ + component: Index })