floppydisk
floppydisk
TtRPC
Created by floppydisk on 5/29/2025 in #❓-help
How to share the types correctly?
Hey everyone, I have a basic question regarding sharing types between my Fastify back-end and my Expo front-end. I'm using a monorepo and I'm using pnpm workspaces. My back-end package.json includes:
"types": "dist/types.d.ts",
"exports": {
"./trpc": "./src/types.ts"
},
"types": "dist/types.d.ts",
"exports": {
"./trpc": "./src/types.ts"
},
And types.ts:
export type { AppRouter } from "./routers/_app";
export type { AppRouter } from "./routers/_app";
Inside my package.json for my front-end I do:
"@myrepo/api": "workspace:*",
"@myrepo/api": "workspace:*",
This works fine and as expected until I try to use path aliases inside my back-end. I understand why this breaks, but is there a way around it? Is my initial setup already wrong?
4 replies