mh
mh
TtRPC
Created by michaelp7725 on 11/4/2024 in #❓-help
What are the benefits of adding db to context rather than importing it directly in the router?
it's a matter of preference. don't think there is any benefit or loss in either approach.
3 replies
TtRPC
Created by MichaelJC91 on 10/21/2024 in #❓-help
React app not inferring trpc client correctly
no luck with rc-382 either for me. stuff still gets typed as 'never'. for the moment we are stuck with 10.45.2. I will try to spend some time narrow down the issue a bit more but v11.x seems unusable for us atm.
19 replies
TtRPC
Created by MichaelJC91 on 10/21/2024 in #❓-help
React app not inferring trpc client correctly
I have not done it yet, will attempt later this evening
19 replies
TtRPC
Created by MichaelJC91 on 10/21/2024 in #❓-help
React app not inferring trpc client correctly
np
19 replies
TtRPC
Created by MichaelJC91 on 10/21/2024 in #❓-help
React app not inferring trpc client correctly
19 replies
TtRPC
Created by MichaelJC91 on 10/21/2024 in #❓-help
React app not inferring trpc client correctly
ah interesting. I will try a version prior to rc-383 and report back. thanks for the heads up.
19 replies
TtRPC
Created by MichaelJC91 on 10/21/2024 in #❓-help
React app not inferring trpc client correctly
was set to 11.0.0-rc.586
19 replies
TtRPC
Created by MichaelJC91 on 10/21/2024 in #❓-help
React app not inferring trpc client correctly
no, I use pnpm as well. our project is a turbo mono repo using pnpm. All our types work using v 10.45.2 but moving over to v11.x immediately breaks type inference for us (no other code changes)
19 replies
TtRPC
Created by MichaelJC91 on 10/21/2024 in #❓-help
React app not inferring trpc client correctly
I think you may have the same issue as me https://discord.com/channels/867764511159091230/1296744845305450546/1296744845305450546. I have not found a solution yet but it looks like we have a very similar repo structure. mono repo with a shared package but router type is inferred as never
19 replies
TtRPC
Created by mh on 10/18/2024 in #❓-help
Types issues upgrading to v11, `never` when using t.router
Weird thing is, if I use initTrpc directly in the api project in the exact same way as in the shared project, the types start working.
import { Context, procedure } from "trpc-server-shared";
import { initTRPC, type inferRouterInputs } from "@trpc/server";

const t = initTRPC.context<Context>().create();
// don't use router from shared package, note t.router. procedure can still be from shared package
export const appRouter = t.router({
health: t.router({ check: procedure.query(() => ({ healthy: "ok" })) })
});

type AppRouter = typeof appRouter;
type AppRouterInputs = inferRouterInputs<AppRouter>;
import { Context, procedure } from "trpc-server-shared";
import { initTRPC, type inferRouterInputs } from "@trpc/server";

const t = initTRPC.context<Context>().create();
// don't use router from shared package, note t.router. procedure can still be from shared package
export const appRouter = t.router({
health: t.router({ check: procedure.query(() => ({ healthy: "ok" })) })
});

type AppRouter = typeof appRouter;
type AppRouterInputs = inferRouterInputs<AppRouter>;
Now AppRouterInputs has correct typing instead of never We are using typescript 5.6.2, node v22.9.0, pnpm v9.12.0 and have sctrict: true, also have
"declaration": true,
"declarationMap": true,
"declaration": true,
"declarationMap": true,
5 replies