-
-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: External typescript types #83
Comments
Hey there @fauh45, this is a valid point. There's a solution on the roadmap which is tracked in #61. The idea is to allow users to include a "prelude", basically a string prepended to the generated file. This prelude could include import statements etc. The funny thing is though is that we already support the exact syntax you suggested by total accident! If you make the import relative to the directory the generated file ends up in, it works great. This was absolutely unintentional which is hilarious, but actually a pretty powerful feature. |
I might just add this to the README to be fair 😆 |
Ups I didn't see #61 sorry! And somehow the syntax I wrote just works with kysely-prisma? I should've tried generating what I made first lol. Well this revelation fixes my problem then, I could just import my types relative to output folder, which should be easy. Also, you should absolutely put this to README haha, or if you want i can shoot a PR as well. |
Hey @fauh45 if you still want to create a PR that adds this to the README that would be great :) |
While it is already possible to set typescript type declaration for columns in prisma schema using
/// @kyselyType( ... )
. I don't think there's a way to set the column type with typescript definition outside of the schema. This will be so useful for JSON column types, as sometimes it does contains a complex metadata structure, that's usually opaque to the programmer.I suppose it'll be great to have something like,
types.ts
prisma.schema
The text was updated successfully, but these errors were encountered: