Skip to content

Incorrect types on SELECT when spreading related tables #482

Closed
@masda70

Description

@masda70

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions