43
Better Typescript Types
Source: supabase/supabase#13364 · opened by @FroggyPanda
The current way to extract row types from supabases typescript types is like so:
which, in my opinion, is not the best way to do it. Whenever I want to make sure my function return type is the same type as my database, I need to make a new type in that file or have another file that holds all of my table types. I am thinking of on top of generating the Database type, supabase also generates the row types, so there is no need to do that long type abstraction when, in my opinion, it should be as easy as:
Edit 1: Edited title from 'Better Typesciprt Row Types' to 'Better Typescript Types' as I feel [Barry's reply]( and others can help improve the types generated
Edit 2: Going to do a shameless plug for [better-supabase-type]( and [Barry's supabase-react-query-codegen]( Hope people who would like to see supabase have better first-party types find these packages useful, and the supabase team gets inspiration from these projects.
which, in my opinion, is not the best way to do it. Whenever I want to make sure my function return type is the same type as my database, I need to make a new type in that file or have another file that holds all of my table types. I am thinking of on top of generating the Database type, supabase also generates the row types, so there is no need to do that long type abstraction when, in my opinion, it should be as easy as:
Edit 1: Edited title from 'Better Typesciprt Row Types' to 'Better Typescript Types' as I feel [Barry's reply]( and others can help improve the types generated
Edit 2: Going to do a shameless plug for [better-supabase-type]( and [Barry's supabase-react-query-codegen]( Hope people who would like to see supabase have better first-party types find these packages useful, and the supabase team gets inspiration from these projects.
No pledges yet. Be the first to back this.
Comments
Similar requests
Generated TypeScript Types - Add type safe to Tables
2 votes · 0 comments
Improved type inference for JSONB columns with check constraints in supabase typescript client
3 votes · 0 comments
Native TypeScript Enums
2 votes · 0 comments
supabase types - improve types for TypeScript intellisense
1 vote · 0 comments
access to enum unions in db.types.ts (CLI: supabase gen types typescript)
8 votes · 0 comments
No comments yet.