supabase / postgrest-js

Isomorphic JavaScript client for PostgREST.

Home Page:https://supabase.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect types on SELECT when spreading related tables

masda70 opened this issue · comments

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

Spreading related tables, as described in this article , are not properly typed.

const { data } = await supabase.from('films').select(`
    title,
    ...technical_specs (
      camera, laboratory, duration
    )
  `)
console.log(data)

yields ParserError<"Expected identifier at ...technical_specs (camera, laboratory, duration)

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Use the table definitions from https://supabase.com/blog/postgrest-11-prerelease
  2. Write the above code within a supabase client environment.
  3. Build the project

Expected behavior

The type should be {title: string, camera: string, laboratory: string, duration: string}[] | null

System information

  • OS: [e.g. Ubuntu]
  • Version of supabase-js: 2.37.0
  • Version of Node.js: v18.17.1