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

#523 fix typescript error for aggregate functions #531

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

stefan-girlich
Copy link

What kind of change does this PR introduce?

Fix dynamic TypeScript type for data when using aggregate functions other than count

What is the current behavior?

Aggregate functions other than count will result in TypeScript errors for the resulting type of data (#523)

Bug fix for issues:

What is the new behavior?

Using the other aggregate functions "sum", "avg", "min", and "max" will not result in an erroneous TypeScript type for data.

Additional context

I just generalized changes from #520 by @bnjmnt4n ; thanks for your work!

@bnjmnt4n
Copy link
Contributor

Do the queries work when just querying Postgrest? My understanding when implementing this, based on https://postgrest.org/en/v12/references/api/aggregate_functions.html, was that the syntax was column.max(), and not column(max).

@stefan-girlich
Copy link
Author

@bnjmnt4n You're right; column(max) is not valid; my fix is therefore not ideal as it allows for invalid syntax.
Would you have any idea concerning how to fix the issues with the other aggregation functions besides count() (#523 , #524 )?

@bnjmnt4n
Copy link
Contributor

Do you have a reproducible failing test case or example?

@stefan-girlich
Copy link
Author

stefan-girlich commented Apr 10, 2024

Sure; I mentioned them in #523 for visibility: #523 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants