valtyr / prisma-kysely

🪄 Generate Kysely types directly from your Prisma schema!
https://www.npmjs.com/package/prisma-kysely
MIT License
934 stars 36 forks source link

how to generate custom json types with prisma-json-types-generator? #32

Closed waptik closed 1 year ago

waptik commented 1 year ago

Hi. I tried using prisma-json-types-generator but it looks the json type generated by prisma-kysely is still unknown even after declaring prisma-kysely right after prisma-json-types-generator

valtyr commented 1 year ago

Hey there @waptik. We don't have any inter-compatibility with other generators, and it's not planned as of right now. Sorry. You could possibly use zod to achieve what you're looking for, or just perform a straight cast if you are confident that the type is correct.

Pruxis commented 1 year ago

@valtyr Would you accept PR's if I checked on how to make it compatible with other generators?

valtyr commented 1 year ago

@pruxis I have a separate feature planned that should make this possible. We already support per-field type overrides using the /// @kyselyType(...) docstring. Here's the section in the README. What's missing is a way to add a preamble to the prisma-kysely output file with import statements. We'll be tracking the feature in issue #61.