Hacker News new | ask | show | jobs
by primering 1465 days ago
They surely can be used in the app, but a) requires that code generation and b) you are limited by the expressiveness of Prisma's DSL. The DSL supports much less than TypeScript. The last time I looked: No support for generics, conditional types, mapped types, (const) enums, index signatures, class instances (+methods), and more. Basically you lose the full power of TypeScript that way. Also you would have no way of using that interface in validation and serialisation, which is more important than just using it in type checking - you would need to rewrite the entity in another format like json-schema or zod-like libraries, which means at the end you still duplicate it.
1 comments

I was pretty sure that Prisma also supported generating OpenAPI schemas and GraphQL, but maybe I'm wrong.

Fair point about expressiveness, but if your data must cross application boundaries then you are somewhat limited in expressiveness no matter what, because your types need to be understood by arbitrary clients.

Lack of generics is pretty annoying though. It's probably my biggest annoyance with GraphQL.

Good point. That's why I'm working on a C++ version of TypeScript's type checking./computation so it can be used in all languages. That would allow us to use TypeScript types literally everywhere and remove that barrier.

Prisma's DSL has no syntax for validation constraints, so even with openAPI generators it's incomplete.

Very interested in this. Is there a good place to stay updated on your progress?
I’m also interested in any updates regarding this entire stack.
I'm really bad at marketing, but I regularly tweet [0] and chat with the discord [1] community. I'm trying keep the followers up to date with the C++ typescript stuff. Feel free to join

[0] [url-redacted] [1] [url-redacted]

Will do.
Join the Discord!