From 639285af82d94f2d76301e557491fa7283beb229 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Valverd=C3=A9?= Date: Sat, 7 Sep 2024 18:48:44 +0200 Subject: [PATCH] TRCPRouter --- src/TRPC/TRPCRouter.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/TRPC/TRPCRouter.ts b/src/TRPC/TRPCRouter.ts index 827e478..55226bb 100644 --- a/src/TRPC/TRPCRouter.ts +++ b/src/TRPC/TRPCRouter.ts @@ -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) => { - class TRPCRouter extends Context.Tag("@thilalib/TRCP/TRPCRouter")() {} +export const Identifier = "@thilalib/TRPC/TRPCRouter" +export interface TRPCRouter extends Context.Tag {} + +export const TRPCAnyRouter = Context.GenericTag(Identifier) + + +export const make = ( + router: Effect.Effect +) => { + const TRPCRouter = Context.GenericTag(Identifier) const TRPCRouterLive = Layer.effect(TRPCRouter, router) - return { TRPCRouter, TRPCRouterLive } + return { TRPCRouter, TRPCRouterLive } as const }