You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for all the great answers & support in this community. Love trying out Hono.
My issue is that I'm using Hono's typegen with rollup-plugin-dts to generate a typed RPC API interface that can be consumed by the frontend using hono/client. The problem I'm running into is related to how Prisma client types are referenced in the generated file.
However, .prisma/client doesn't exist as a local path—it’s generated inside node_modules, as expected with Prisma. This leads to type resolution issues in the server as well as client projects (since Prisma isn’t installed on client and the paths are different on server).
As seen in the attached screenshot, this results in type errors in the consuming frontend code because Prisma types like PrismaJson.MasterCarrier can't be resolved.
Question
Is there a recommended way to:
Bundle Prisma types into the generated .d.ts at build time?
Replace Prisma-specific types with custom DTOs before typegen runs?
I'd prefer not to ship the entire Prisma client to the frontend just for type safety. Any suggestions on how to cleanly handle this? Appreciate any guidance! 🙏
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi folks,
Thanks for all the great answers & support in this community. Love trying out Hono.
My issue is that I'm using Hono's typegen with
rollup-plugin-dts
to generate a typed RPC API interface that can be consumed by the frontend usinghono/client
. The problem I'm running into is related to how Prisma client types are referenced in the generated file.Setup
I have a
hono-api.d.ts
file generated via:Then I consume this file in the client using:
Rollup Config
The Issue
The generated file (
hono-api.d.ts
) contains:However,
.prisma/client
doesn't exist as a local path—it’s generated insidenode_modules
, as expected with Prisma. This leads to type resolution issues in the server as well as client projects (since Prisma isn’t installed on client and the paths are different on server).As seen in the attached screenshot, this results in type errors in the consuming frontend code because Prisma types like
PrismaJson.MasterCarrier
can't be resolved.Question
Is there a recommended way to:
.d.ts
at build time?I'd prefer not to ship the entire Prisma client to the frontend just for type safety. Any suggestions on how to cleanly handle this? Appreciate any guidance! 🙏
Beta Was this translation helpful? Give feedback.
All reactions