Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[supabase-js] Parser error for using aggregate and spread #524

Open
2 tasks done
thecoorum opened this issue Mar 11, 2024 · 4 comments
Open
2 tasks done

[supabase-js] Parser error for using aggregate and spread #524

thecoorum opened this issue Mar 11, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@thecoorum
Copy link

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

A clear and concise description of what the bug is.

To Reproduce

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

  1. Create a typed Supabase client with (types are generated with npx supabase gen types typescript --local
    createClient<Database>(...)
    
  2. Try to query data
    2a. Using spread in select
    .select('...users (first_name, last_name)')
    2b. Using newly introduced aggregate functions
    .select('from:from_time.min(), till:till_time.max()')

2a will type fail with PostgrestSingleResponse<ParserError<"Expected identifier at '...users (first_name, last_name'">>
2b will type fail with PostgrestSingleResponse<ParserError<"Unexpected input: .min(), till:till_time.max()">>

Expected behavior

No TypeScript errors

System information

  • OS: macOS
  • Version of supabase-js: ^2.39.7
  • Version of Node.js: 19.4.0
@thecoorum thecoorum added the bug Something isn't working label Mar 11, 2024
@encima encima transferred this issue from supabase/supabase Mar 12, 2024
@encima
Copy link

encima commented Mar 12, 2024

Also transferring issue to postgrest-js repo. Related to #447 which was fixed recently. Could be combined with #523 and #520

@stefan-girlich
Copy link

@encima Would you know if there is a workaround? Right now, I'm casting all outputs to any before further processing. Maybe there is an casting-based approach utilizing the Supabase types that are already generated.

@bnjmnt4n
Copy link
Contributor

bnjmnt4n commented Apr 9, 2024

@stefan-girlich are you using the latest version of supabase-js?

@stefan-girlich
Copy link

Thanks for the hint. I upgraded supabase-js, but I'm now seeing a new error. I added an updated in my original bug report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants