从 @prisma/client导入枚举给出了“模块” @prisma/client&quot&quot&quot&quot&quot&quot&quot&quot&quot&quot'没有导出的成员模态'
我想在ORM模型中使用我在schema.prisma文件中定义的枚举(我正在使用TypeGraphQL)。
我的Prisma模式定义为
enum Modality {
CT
MAMMO
MRI
STEREO
}
在运行npx Prisma生成
后,以下打字稿代码生成错误。
import { Modality } from "@prisma/client";
> src/schema/ImagingCenter.ts:4:10 - error TS2305: Module '"@prisma/client"' has no exported member 'Modality'.
我能够导入Prismaclient并在我的应用程序中使用它,但是我无法导入任何特定类型或枚举。
我在Prisma客户端〜3.11.0,并且在我的tsconfig.json中有以下内容:
"target": "es2018",
"allowJs": true,
"module": "commonjs",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
根据这篇文章,我的设置似乎可以正常工作吗? 如何在Prisma Client中获得枚举?
I want to use the Enum I defined in my schema.prisma file in my ORM model (I'm using TypeGraphQL).
My prisma schema is defined as
enum Modality {
CT
MAMMO
MRI
STEREO
}
After running npx prisma generate
, the following TypeScript code generates an error.
import { Modality } from "@prisma/client";
> src/schema/ImagingCenter.ts:4:10 - error TS2305: Module '"@prisma/client"' has no exported member 'Modality'.
I'm able to import PrismaClient and use it just fine in my application, but I'm unable to import any particular types or enums.
I'm on Prisma client ~3.11.0 and have the following in my tsconfig.json:
"target": "es2018",
"allowJs": true,
"module": "commonjs",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
Based on this post, it seems like my setup should work fine? How to get enums in prisma client?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确保您运行了
,
我也遇到了这个问题,这些命令可以解决
Make sure you have run
and
I've faced this problem too and these commands can fix