© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•2mo ago•
2 replies
alaninnovates

Supabase auto-typings for typescript

🤷other🟡javascript
Hello! I have the following query below:
const {data, error} = await supabase
   .from('ensemble_memberships')
   .select('ensembles(id,name), role, requested_at, approved_at')
   .eq('user_id', profile.id);
const {data, error} = await supabase
   .from('ensemble_memberships')
   .select('ensembles(id,name), role, requested_at, approved_at')
   .eq('user_id', profile.id);


If you look at the return type of "data:
const data: {
    ensembles: {
        id: any
        name: any
    }[]
    role: any
    requested_at: any
    approved_at: any
}[] | null
const data: {
    ensembles: {
        id: any
        name: any
    }[]
    role: any
    requested_at: any
    approved_at: any
}[] | null

As you can see, the ensembles property is an array. HOWEVER, in reality, there will only ever be one ensemble per returned row, so there should not be an array! This is confirmed by what supabase actually returns, so the typing is incorrect.

Is there a reason why its return value of ensembles is an array? Can I change that somehow? Thanks!
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Auto confirmation by supabase
SupabaseSSupabase / help-and-questions
3mo ago
Typescript Database Typings with CLI on Cloud Database
SupabaseSSupabase / help-and-questions
4y ago
Best TypeScript DX for Supabase Edge Functions
SupabaseSSupabase / help-and-questions
13mo ago
Complete Typings
SupabaseSSupabase / help-and-questions
4y ago