Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

[WIP] Improve typing of groupBy pipe #101

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/aggregate/group-by.pipe.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import { Pipe, PipeTransform, NgModule } from '@angular/core';
import { getProperty, isArray, isUndefined } from '../utils/utils';

class GroupByResult<T> {
value: Array<T>;
key: any;
}

@Pipe({
name: 'groupBy',
})
export class GroupByPipe implements PipeTransform {
transform(input: any, prop: string): Array<any> {
transform<T>(input: Array<T>, prop: string): Array<GroupByResult<T>> {
if (!isArray(input)) {
return input;
}
Expand Down