mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
[Crossfilter] Change return type of group.all() to a readonly array (#36707)
* Change return type of group.all() to a readonly array * Added a test * Hopefully fix tests
This commit is contained in:
parent
04bd0915e7
commit
b27c0cf67a
@ -62,9 +62,7 @@ var paymentGroupsByTotal = paymentsByTotal.group(total => Math.floor(total / 100
|
||||
|
||||
paymentGroupsByTotal.size();
|
||||
|
||||
// bug of TS 0.9.5 https://typescript.codeplex.com/discussions/471751
|
||||
//paymentGroupsByTotal.reduce((p, v) => p + 1, (p, v) => p - 1, () => 0);
|
||||
paymentGroupsByTotal.reduce<number>((p, v) => p + 1, (p, v) => p - 1, () => 0);
|
||||
paymentGroupsByTotal.reduce((p, v) => p + 1, (p, v) => p - 1, () => 0);
|
||||
|
||||
paymentGroupsByTotal.reduceCount();
|
||||
|
||||
@ -115,6 +113,12 @@ topTypes[0].value; // the count of payments of that type (e.g., 8)
|
||||
|
||||
var types = paymentCountByType.all();
|
||||
|
||||
// $ExpectError
|
||||
types.sort();
|
||||
|
||||
types[0].key;
|
||||
types[0].value;
|
||||
|
||||
paymentsByTotal.dispose();
|
||||
|
||||
crossfilter.bisect([], null, 0, 0);
|
||||
|
||||
4
types/crossfilter/index.d.ts
vendored
4
types/crossfilter/index.d.ts
vendored
@ -1,6 +1,6 @@
|
||||
// Type definitions for CrossFilter
|
||||
// Project: https://github.com/square/crossfilter
|
||||
// Definitions by: Schmulik Raskin <https://github.com/schmuli>, Izaak Baker <https://github.com/iebaker>, Einar Norðfjörð <https://github.com/nordfjord>
|
||||
// Definitions by: Schmulik Raskin <https://github.com/schmuli>, Izaak Baker <https://github.com/iebaker>, Einar Norðfjörð <https://github.com/nordfjord>, Tijmen Wildervanck <https://github.com/TijmenW>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace CrossFilter {
|
||||
@ -73,7 +73,7 @@ declare namespace CrossFilter {
|
||||
|
||||
export interface Group<T, TKey, TValue> {
|
||||
top(k: number): Grouping<TKey, TValue>[];
|
||||
all(): Grouping<TKey, TValue>[];
|
||||
all(): ReadonlyArray<Grouping<TKey, TValue>>;
|
||||
reduce<TGroup>(add: (p: TGroup, v: T) => TGroup, remove: (p: TGroup, v: T) => TGroup, initial: () => TGroup): Group<T, TKey, TGroup>;
|
||||
reduceCount(): Group<T, TKey, number>;
|
||||
reduceSum<TGroup>(value: (data: T) => TGroup): Group<T, TKey, TGroup>;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user