© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago
Deleted User

Supabase generated enum type to array

Hello,
When we generate the types with
supabase gen types typescript
supabase gen types typescript

We have something like this

Enums: {
approvalactionstate: "approve" | "deny" | "cancel"
}
Then we can get the type like this

type ApprovalactionstateEnum = Database['public']['Enums']['approvalactionstate']
type ApprovalactionstateEnum = Database['public']['Enums']['approvalactionstate']

I would like to use the enum list to generate a select in a form.
How can I get something like

const approvalactionstates: ApprovalactionstateEnum[] = ['approve', 'deny', cancel'] 
const approvalactionstates: ApprovalactionstateEnum[] = ['approve', 'deny', cancel'] 


so I can use it like this :

                      {approvalactionstates.map(state => (
                        <MenuItem key={state} value={state}>
                          {state}
                        </MenuItem>
                      ))}
                      {approvalactionstates.map(state => (
                        <MenuItem key={state} value={state}>
                          {state}
                        </MenuItem>
                      ))}


Thanks for your help.
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,729Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Supabase Enum Type Error When Adding to Column
SupabaseSSupabase / help-and-questions
14mo ago
add enum type
SupabaseSSupabase / help-and-questions
4y ago
Supabase RPC functions return type shows a 2D array?
SupabaseSSupabase / help-and-questions
4y ago
Can you change supabase generated Json types?
SupabaseSSupabase / help-and-questions
4y ago