I'm working on a NestJS backend and using Prisma for my database. I generated my Prisma type with the following configuration:
generator clientTypes {
provider = "prisma-client-js"
output = "../ts-rest/types/generated/client"
}
I'm using ts-rest to share the same types between my frontend and backend. I need to import an enum from Prisma like this:
import { CUSTOMER_TYPE } from "ts-rest/types/generated/client";
However, when I try to compile, I get a MODULE_NOT_FOUND error in the file where this import is used. If I change the import path to "@prisma/client", the error is resolved, but I can't use that in my frontend. I use nest start --watch
to compile directly my code.
After some research, I found that the issue occurs because the generated Prisma types are not included in the dist/ts-rest folder after compilation so in the compiled code the type is not present.
Why aren't the Prisma-generated types being copied to the dist folder, and how can I resolve this?
I already tried modifying nest-cli.json, with this:
"compilerOptions": {
"assets": ["ts-rest/types/generated/**/*"]
}
but that didn't fix the issue.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745067654a4609350.html
评论列表(0条)