Zenstack generate fails when trying to use tRPC plugin with strongly typed JSON
Description and expected behavior
When I add a strongly typed JSON column to my schema, and then run zenstack generate with the tRPC plugin enabled, it generates, but the generated code is unable to be compiled by tsc due to the following error:
The inferred type of 'createRouter' cannot be named without a reference to '../../../../node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/.zenstack/logical-prisma-client/runtime/library.js'. This is likely not portable. A type annotation is necessary.
15 export default function createRouter() {
~~~~~~~~~~~~
I'd expect it to just work, not sure where it's trying to reference the deep path from.
Environment (please complete the following information):
- ZenStack version: 2.18.1
- Prisma version: 6.6.0
- Database type: postgresql
Somewhat related: https://github.com/zenstackhq/zenstack/issues/560
Hi @k-ahlawat , this error looks familiar but I couldn't reproduce it with a trpc project at hand (trpc 11 + pnpm). Do you have a sharable repro project? Thanks!
Unfortunately I don't have a standalone repro at the moment.
The whole thing started because tRPC (v11) can't properly infer Prisma.JsonValues on the client side due to the Serialize<T> type they have.
I thought it'd be easier to solve by just strongly typing the columns.
Related tRPC issue is here