All values in DecoratedProcedureRecord are of type any

I've stumbled across an issue and I'm not sure how to start diagnosing it... Basically in my IDE the return type of my createTRPCProxyClient<AppRouter>(...) call is a DecoratedProcedureRecord where every value is of type any. I'm seeing a lot of issues with TS seemingly struggling to work with this repo, I suspect that the types have become too complex with tRPC and the ORM I'm using. Is it possible that TS has just "given up" so returns any instead of the expected type? Or is it likely something else?
R
rdβ€’314d ago
I've tried stripping down the router to a single merge with one procedure though and it's still of type any πŸ€·β€β™‚οΈ Ah, I think it's related to using paths in a ts-config in a monorepo, seems like the consuming package potentially can't resolve the imports
N
Nickβ€’314d ago
Can you share your project structure and the tsconfig for the client?
R
rdβ€’314d ago
I can if it would be helpful, anything specifically? I'm certain this isn't a tRPC issue now though, I removed path aliases from the internal package/tsconfig and the types reappeared.
N
Nickβ€’314d ago
Yeah it’s more project setup, but we treat that as something we can generally help figure out!
R
rdβ€’314d ago
Not sure if this is clear or not! Appreciate the help but no pressure of course πŸ™‚
tsconfig.json
- apps
- client
- tsconfig.json
- server
- tsconfig.json
tsconfig.json
- apps
- client
- tsconfig.json
- server
- tsconfig.json
root tsconfig:
{
"files": [],
"references": [
{
"path": "./apps/server"
},
{
"path": "./apps/client"
},
]
}
{
"files": [],
"references": [
{
"path": "./apps/server"
},
{
"path": "./apps/client"
},
]
}
server tsconfig:
{
"compilerOptions": {
"baseUrl": ".",
"composite": false,
"declaration": false,
"declarationMap": false,
"esModuleInterop": true,
"inlineSources": false,
"isolatedModules": true,
"module": "CommonJS",
"moduleResolution": "node",
"noUnusedLocals": false,
"noUnusedParameters": false,
"outDir": "./dist",
"rootDir": "./src",
"skipLibCheck": true,
"strict": true,
"target": "ES2022",
"types": ["vitest/globals", "node"],
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["src"],
"exclude": ["node_modules", "src/**/*.spec.ts", "src/**/*.test.ts"],
"ts-node": {
"require": ["tsconfig-paths/register"],
"transpileOnly": false
}
}
{
"compilerOptions": {
"baseUrl": ".",
"composite": false,
"declaration": false,
"declarationMap": false,
"esModuleInterop": true,
"inlineSources": false,
"isolatedModules": true,
"module": "CommonJS",
"moduleResolution": "node",
"noUnusedLocals": false,
"noUnusedParameters": false,
"outDir": "./dist",
"rootDir": "./src",
"skipLibCheck": true,
"strict": true,
"target": "ES2022",
"types": ["vitest/globals", "node"],
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["src"],
"exclude": ["node_modules", "src/**/*.spec.ts", "src/**/*.test.ts"],
"ts-node": {
"require": ["tsconfig-paths/register"],
"transpileOnly": false
}
}
client tsconfig:
{
"extends": "@vue/tsconfig/tsconfig.dom.json",
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
},
"lib": ["ES2016", "DOM", "DOM.Iterable"]
}
}
{
"extends": "@vue/tsconfig/tsconfig.dom.json",
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
},
"lib": ["ES2016", "DOM", "DOM.Iterable"]
}
}
N
Nickβ€’314d ago
Do you have separate package.json files or just one in the root? or you're using npm workspaces? Often adding the server file which exports the AppRouter to the client's tsconfig "include" fixes a lot of issues (via relative path) If you then run into anything complaining about non-portable types that would generally happen when you have separate node_modules folders via separate package.json files. Using workspaces with hoisting, or installing in the root can help there
R
rdβ€’314d ago
Hey thanks, yes separate package.json files, using turborepo and npm workspaces (I think), all dependencies are installed in the root node_modules dir. I'll see if adding the server file to "include" helps, appreciate the advice πŸ™‚
More Posts
Detecting batch queries/mutations on the server-sideHello all, Looking to leverage batching as a means to streamline some of our cross-service requests,VS Code becomes unresponsiveHello everyone, I've started to experience huge performance issues with my project that's based onMiddleware-ish for clientHi! I had a quick question about client-side usage: I have users with long-running sessions, and iWhy cannot I specify a mutation input with useQueryKey?It's supported with queries, but for some reason not with mutations. Why is this the case?how to connect trpc server (t3 stack) from my external nextjs app?how to connect trpc server (t3 stack) from my external nextjs app?trpc.legacyRouterName.procedure "does not exist" on type CreateTRPCNextBase, runs anywayHave reached the end of a massive trpc 9 -> trpc 10 migration, executed using the official guide witNot getting legacy router ops in merged tRPC 9 routerFollowed the guide to merge my large tRPC 9 router with tRPC 10, but now I can't use useQuery or acccreateTRPCNext Type Error + useQuery Not DefinedI'm trying to use the conventions for `createTRPCNext ` from https://github.com/trpc/examples-next-pRead response headers on the clientIve been searching for a while trying to figure out how to access response headers on the client. FoIs it possible to access context in input?Hi, I have a validator that requires to get context of prisma in the `input`, Is it possible to get TRPCContextState not found in v10In our v9 app, we used TRPCContextState from internals to type out TRPC utils, importing it like `imRateLimiter for fastify tRPC routesHi, I would like to add Ratelimiter to a specific fastify trpc route, are there any solutions availaSubscriptionsare we able to send data over with subscriptions, to allow for full duplex communication ?Query tRPC the right wayIf you use graphql, you can precisely query what you exactly need and avoid over fetching, so you caHow does trpc subscription actively close/disconnect in the server?How do I actively disconnect my subscription?child router questionlet's say we have a monorepo, one server, two client apps (cat and dog). we make one appRouter, likHow to force SSL on projects using tRPC?Hello everyone, I'm working on a project that uses create-t3-app as boilerplate. My project is hosAWS Lambda / How to set Cookies inside ProceduresHow can I set and remove cookies similar to ctx.res.cookie(..) with Express when using the aws lambdMassive Type Errors on tRPC 10 Legacy Router against MergeRouterWe're trying to upgrade to tRPC 10 but I am running into a massive type clash when trying to merge rIs it possible to create 2 routers inside a single file?I am having an issue in which it is impossible to me to use a class instance within 2 routers. I tri