What do you think about removing the "Decimal" lib...
# orm-help
a
What do you think about removing the "Decimal" library from Prisma completely? I think it should be up to every development to decide if they want to use it. For me it crashing all my Rest API definitions Types since the API returns either a string or number but Prisma returns a Prisma.Decimal types. The following won't work because Prisma.Decimal does not match string type, even if when Prisma.Decimal is serialized to JSON, it becomes a string
Copy code
// prisma.client.ts
export type Post {
  decimal: Prisma.Decimal
}

// post.entity.ts
class Post {
  decimal: string
}

// post.controller.ts
async function findOnePost(): Promise<Post> {
  return prisma.post.findOne() 
}
j
It caused us all sorts of headaches while migrating from
mysql
.
o
It caused us issues too. Prisma should provide a way to override this behavior. Not sure if such a thing was implemented since then.
n
Hey Adrian 👋 I see you already created a Feature Request for opting out of Decimal.js here: #13451 Thanks for doing that.
a
@Nurul Hi, thanks for your awareness. @Jason Kleinberg @Omar It would be super helpful to move the issue forward if you would also comment the Feature Request so that the Prisma team knows there are more people suffering because of Decimal.js
o
@Adrian I added a thumbs up to it. But it won't be as quick as you might think. The related issue has been open since may 2021.