FG
💻 Software🗄️ DatabasesVercel

Use @map'ed enum values as TS enum values

Fresh4 months ago
Mar 14, 20260 views
Confidence Score78%
78%

Problem

Problem Consider the following schema: [code block] In database, it works as expected, the enum name and values are taken from the `@map` and `@@map` directives. In TypeScript, however, the generated values are as follows: [code block] Which is a problem, because every time you want to serialize the object returned from the database by prisma, you have to remap these values to the ones that the project uses (which is the database version). A simplified example would look like this: [code block] It gets much worse when there are nested includes. Suggested solution If explicitly defined, use values from `@map` directives as enum values, like so: [code block]

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
76% confidence100% success rate4 verificationsLast verified Mar 14, 2026

Solution: Use @map'ed enum values as TS enum values

Low Risk

It's a serious problem and it's been a year and still not fixed. 😭

76

Trust Score

4 verifications

100% success
  1. 1

    It's a serious problem and it's been a year and still not fixed. 😭

    It's a serious problem and it's been a year and still not fixed. 😭

Validation

Resolved in prisma/prisma GitHub issue #8446. Community reactions: 7 upvotes.

Verification Summary

Worked: 4
Partial: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

prismaormpostgresqlkind/featuretech/typescripttopic:-enumtopic:-breaking-change