@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user