RobinBlomberg / kysely-codegen

Generate Kysely type definitions from your database.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature] Customizable generated table type names

bombillazo opened this issue · comments

Hello,

We have a use case where we need the Generated Kysely type to have either a suffix or prefix to differentiate it from our application types representing the same resource. It would be great to be able to specify an suffix like Table to all generated types so our IDE can auto import and identify types correctly and discriminate from our custom types.

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
commented

It would be great to be able to specify an suffix like Table to all generated types

I am just getting started with kysely/kysely-codegen but I was actually expecting this to be the default behavior as per kysely getting started docs ( https://kysely.dev/docs/getting-started?package-manager=npm ) types section it is actually shown specifically to "not use the table schema interfaces directly" and we can see in their code examples they way they demonstrate distinguishing is by having the database table interfaces have suffix of 'Table' and exporting the wrapped Selectable type as the table name alone.

@RobinBlomberg Would you be open to this being the default behavior in general separate from this requiring an ability to customize it? Obviously that could be seen as a breaking change for folks who have built their flows around it not having the 'Table' suffix.