© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•3w ago•
3 replies
James0r

Typescript issue with joins

🤷other
I'm doing some joins like so

  const { data: cafes, error } = await supabase
    .from('cafes')
    .select('id, name, slug, city_id, city:cities!inner(slug, name)')
    .eq('city.slug', citySlug)
    .order('name')
  const { data: cafes, error } = await supabase
    .from('cafes')
    .select('id, name, slug, city_id, city:cities!inner(slug, name)')
    .eq('city.slug', citySlug)
    .order('name')


and creating the alias city. Typescript is expecting

city: {slug, name}[] array but the shape of the actual data is

  {
    id: '08087240-df6a-4b61-a579-d6a516b65339',
    name: 'Beans & Bytes',
    slug: 'beans-bytes',
    city_id: 'b433ad4a-55d1-4138-8419-d4375f13814c',
    city: { name: 'Austin', slug: 'austin' }
  }
  {
    id: '08087240-df6a-4b61-a579-d6a516b65339',
    name: 'Beans & Bytes',
    slug: 'beans-bytes',
    city_id: 'b433ad4a-55d1-4138-8419-d4375f13814c',
    city: { name: 'Austin', slug: 'austin' }
  }

Can't find a clean way to type this.
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

Querying Joins and Nested tables issue
SupabaseSSupabase / help-and-questions
3mo ago
joins across schemas with client
SupabaseSSupabase / help-and-questions
14mo ago
Query with two inner joins Flutter
SupabaseSSupabase / help-and-questions
4y ago
Joins not working
SupabaseSSupabase / help-and-questions
4y ago