2
Generated TypeScript Types - Add type safe to Tables
Source: supabase/supabase#27458 · opened by @JediPixels
I Generated the TypeScript Types for the Database by following the instructions at and initialized it: const supabase = createClient<Database>(process.env.SUPABASE_URL, process.env.SUPABASE_ANON_KEY) Then I retrieve the records from the database: const { data } = await supabase.from(‘contacts’).select(‘*’) I was using interface models like this: But now I would like to use the new Generated TypeScript Types to assign data to a Vue 3 TypeScript ref() Before: After with Generated TypeScript Types: Is this the correct way of doing this with Generated TypeScript Types? It seems that using Tables<‘contacts’> and manually typing the contacts name could cause issues if misspelled. Imagine this being used in many, many places in the app. The following is an example of how I am using them: Feature Request It would be nicer if we could do something like this instead, this way there would be no misspells: Tables.Contacts instead of Table…
No pledges yet. Be the first to back this.
Comments
Similar requests
Improved type inference for JSONB columns with check constraints in supabase typescript client
3 votes · 0 comments
Better Typescript Types
43 votes · 0 comments
Add schema-aware Functions, Args, and Returns helper types to generated Supabase TypeScript types
1 vote · 0 comments
access to enum unions in db.types.ts (CLI: supabase gen types typescript)
8 votes · 0 comments
Feature Request: Add Copy & Paste Functionality for Generated Types in Supabase Dashboard
3 votes · 0 comments
No comments yet.