-
Notifications
You must be signed in to change notification settings - Fork 8
make aggregates explicitly optional on a groupBy #67
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
Conversation
7621a22 to
e912543
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR makes the aggregates parameter on groupBy optional, adds a test case covering the new default behavior, and updates the project’s changeset.
- Allow callers to omit the
aggregatesargument ingroupByby defaulting to an empty object. - Add a unit test verifying
groupByworks without any aggregates. - Update the changeset description to reflect the optional-aggregates change.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/d2mini/src/operators/groupBy.ts | Default aggregates parameter to {} |
| packages/d2mini/tests/operators/groupBy.test.ts | New test: groupBy without aggregates |
| .changeset/clear-impalas-stare.md | Release notes for optional-aggregates feature |
Comments suppressed due to low confidence (1)
packages/d2mini/tests/operators/groupBy.test.ts:18
- [nitpick] The test name 'with no aggregate' could be clearer as 'without aggregates' to better describe running
groupBywith zero aggregates.
test('with no aggregate', () => {
.changeset/clear-impalas-stare.md
Outdated
| '@electric-sql/d2mini': patch | ||
| --- | ||
|
|
||
| make aggrigates explicity optional on a groupBy |
Copilot
AI
Jun 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct spelling in the changeset description: 'aggrigates' → 'aggregates' and 'explicity' → 'explicitly'.
| make aggrigates explicity optional on a groupBy | |
| make aggregates explicitly optional on a groupBy |
| K extends GroupKey, | ||
| A extends Record<string, AggregateFunction<T, any, any>>, | ||
| >(keyExtractor: (data: T) => K, aggregates: A) { | ||
| >(keyExtractor: (data: T) => K, aggregates: A = {} as A) { |
Copilot
AI
Jun 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Using {} as A to default aggregates can hide type mismatches. Consider adding an overload or refining the type parameters to support an omitted-aggregates case without forcing a cast.
* make aggrigates explicity optional on a groupBy * changeset
No description provided.