0.1.17 #18

Merged
Thilawyn merged 37 commits from next into master 2024-09-07 20:56:30 +02:00
Showing only changes of commit 639285af82 - Show all commits

View File

@@ -2,12 +2,17 @@ import type { AnyRouter } from "@trpc/server"
import { Context, Effect, Layer } from "effect"
export const make = <
A extends AnyRouter,
E, R,
>(router: Effect.Effect<A, E, R>) => {
class TRPCRouter extends Context.Tag("@thilalib/TRCP/TRPCRouter")<TRPCRouter, A>() {}
export const Identifier = "@thilalib/TRPC/TRPCRouter"
export interface TRPCRouter<T extends AnyRouter> extends Context.Tag<typeof Identifier, T> {}
export const TRPCAnyRouter = Context.GenericTag<typeof Identifier, AnyRouter>(Identifier)
export const make = <A extends AnyRouter, E, R>(
router: Effect.Effect<A, E, R>
) => {
const TRPCRouter = Context.GenericTag<typeof Identifier, A>(Identifier)
const TRPCRouterLive = Layer.effect(TRPCRouter, router)
return { TRPCRouter, TRPCRouterLive }
return { TRPCRouter, TRPCRouterLive } as const
}