yeetcode.io
yeetcode.io3w ago

all my inferred typings on the frontend are `any`

I have a backend trpc router like this:
import likeRouter from './like';
import postRouter from './post';
import {router} from '../index';
const appRouter = router({like: likeRouter, post: postRouter});
export { appRouter };
export type AppRouter = typeof appRouter;
import likeRouter from './like';
import postRouter from './post';
import {router} from '../index';
const appRouter = router({like: likeRouter, post: postRouter});
export { appRouter };
export type AppRouter = typeof appRouter;
I import the type into my React Native client.
import type { inferRouterInputs, inferRouterOutputs } from "@trpc/server";
import type { AppRouter } from "../../../backend/src/trpc/routers/app";
import type { inferRouterInputs, inferRouterOutputs } from "@trpc/server";
import type { AppRouter } from "../../../backend/src/trpc/routers/app";
But when I try to use inferences, it gets typed weirdly:
type RouterOutputs = inferRouterOutputs<AppRouter>;
type RouterOutputs = inferRouterOutputs<AppRouter>;
Gets typed as:
port type { inferRouterInputs, inferRouterOutputs }

@trpc
type RouterOutputs = {
like: any;
post: any;
}
port type { inferRouterInputs, inferRouterOutputs }

@trpc
type RouterOutputs = {
like: any;
post: any;
}
Why is this happening? My versions across client and server are synced, and I have strict mode on.
1 Reply
yeetcode.io
yeetcode.io3w ago
i think it has to do with some tsconfig relative vs absolute import stuff. i want to use absolute imports on my backend, but have it resolve correctly. how can i configure this? okay fixed it! I had to rewrite my tsconfigs