FeatureFuel
8

access to enum unions in db.types.ts (CLI: supabase gen types typescript)

Source: supabase/supabase#27803 · opened by @logemann
Hi,

supabase gen types typescript generates PG enums as string literal unions which is how it should be. Problem is: There is no sane way of getting an array of those string literals. I need those values for my ZOD schemas to prevent double definitions which 100% will run out of sync.

My proposal: Create the string literal union types from a const context as so:



This way we could access the ENUM values from the generated schema types by just accessing the arrays which are the source for the string literal unions. I for myself need those to declare my ZOD schemas. Of course those attributes there map pretty much 1:1 to my database schema. I really dont want to double declare my enums. Should be enough to delcare them in Postgres DDL.

I could also try to make a pull request for this if somebody gives me a pointer where i can find the source code for the CLI command.

No pledges yet. Be the first to back this.

Make a pledge

Pledge your monetary support if this feature is added.

$

Comments

No comments yet.

Replying to

Add a comment

What do you think about this feature request?


Similar requests