Reputation: 610
For supabase 1 there was open-api to generate types for typescript which is pretty clear: https://supabase.com/docs/guides/api/generating-types
npx openapi-typescript https://your-project.supabase.co/rest/v1/?apikey=your-anon-key --output types/supabase.ts
But I am not able to use them with supabase rc 2.
So I assume I need to follow the new documentation, but there is no description of how to do it. There is only one for local DB. Plus I found --db-url
flag but not more info regarding that.
https://supabase.com/docs/reference/javascript/next/typescript-support
I have tried this command: npx supabase gen types typescript --db-url https://your-project.supabase.co > src/database.types.ts
, but I am getting error: Error: URL is not a valid Supabase connection string.
Thank you for help
Upvotes: 0
Views: 959
Reputation: 11
for --db-url use the connection string shown under /settings/database, I used the node version. It should look something like
postgresql://postgres:[YOUR-PASSWORD]@db.[YOUR-PROJECT-REF].supabase.co:5432/postgres
Upvotes: 1