What does DevTypeMapDef represent, and how is it intended to be used?
Everything's in the title
4 Replies
You chose to debug with a human. They'll tinker with your query soon. If you get curious meanwhile, hop into
#ask-ai for a quick spin!Can you elaborate please? Where did you encounter DevTypeMapDef?
I don't understand the TypeMap constructed by https://github.com/prisma/prisma/blob/f8f315bf2638b1c0de3bd10aa7c9006520b27fd6/packages/client-generator-js/src/TSClient/PrismaClient.ts#L28 — does it represent an actual runtime value, or is it just a type built from another structure like the DMMF?
GitHub
prisma/packages/client-generator-js/src/TSClient/PrismaClient.ts at...
Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB - prisma/prisma
Then in the
TypeMap, there's something like:
It seems like TypeMap is used as the source of truth for typing — it provides the types used throughout the rest of the codebase.
My goal is to understand how Prisma types its client so that I can then design an interface or type that describes what a model is, what metadata is associated with a model, etc. Once that's defined, the idea is that this interface would take a TypeMap as a generic parameter — and from that, we could derive the required operations, metadata, and so on.
This would be a step toward a solution that’s less tightly coupled to Prisma’s current client implementation, and more focused on how Prisma views and describes the underlying data layer. Eventually, this could open the door to using a different ORM that still respects the same principles — such as providing a TypeMap, model metadata, and associated operations.
But honestly, right now I don’t understand much. I know what each part represents, but I don’t know how they were generated, why they were designed that way, or why all of it is necessary. For example, payload seems to contain a lot of information, and I don’t really see why fields would be needed on top of that. That’s why I need help from someone more experienced with databases and Prisma internals.
By the way, I don't know what this is: RenameAndNestPayloadKeys
By the way, what is this? Why do I have relations_ fields (foreign fields)?