npx supabase gen types typescript > database.types.ts
npx supabase gen types typescript > database.types.ts
, all my primary and foreign keys that are UUIDs in SQL become
string
string
in TypeScript.
Is there a way to make this a TS UUID type? (Other than redefining all columns in my TS app — not really an option given the amount of foreign keys in use).
Or are there good reasons to not want this? I guess the query itself also results in type string? Do we know if there is a specific reason for that?
The reason I ask is that the following does not give a type error, but it does give a PostgREST error:
createClient().from('users').select('*').eq('id', '') // ❌ gives a 400 error
createClient().from('users').select('*').eq('id', '') // ❌ gives a 400 error
So when I accidentally set a default value to emtpy string rather than
null
null
, my app began firing requests and throwing errors.
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.