1

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?

Josh V
  • 11
  • 2

1 Answers1

1

Make sure you have run

prisma generate

and

yarn build

I've faced this problem too and these commands can fix