postgrest-js
postgrest-js copied to clipboard
[supabase-js] Parser error for using aggregate and spread
Bug report
- [x] I confirm this is a bug with Supabase, not with my own application.
- [x] 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:
- Create a typed Supabase client with (types are generated with
npx supabase gen types typescript --local
createClient<Database>(...)
- 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
Also transferring issue to postgrest-js repo. Related to https://github.com/supabase/postgrest-js/issues/447 which was fixed recently. Could be combined with #523 and #520
@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.
@stefan-girlich are you using the latest version of supabase-js?
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.