TODO: Support PostgREST Views in TypeScript from() method
Goal
Enable type-safe usage of PostgreSQL VIEWs in supabase.from() by adding a View generic type, similar to how Table is handled.
Tasks
Example
supabase
.from<'active_users'>()
.select('id, email') // correctly infers { id: number; email: string }[]
Notes
- Views are read-only in most cases; consider handling
insert, update, delete appropriately.
- Ensure backward compatibility with existing table handling.
TODO: Support PostgREST Views in TypeScript
from()methodGoal
Enable type-safe usage of PostgreSQL
VIEWs insupabase.from()by adding aViewgeneric type, similar to howTableis handled.Tasks
Schema['Views']to include all relevant database views.ViewNamegeneric constrained tokeyof Schema['Views'].Viewgeneric to represent the selected view's row structure.from()overloads to accept view names and inferView['Row']type.Example
Notes
insert,update,deleteappropriately.