Skip to content

Commit

Permalink
refactor(transducers): add ReductionFn type alias, update Reducer
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Aug 8, 2018
1 parent 723da5b commit 45e4993
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/transducers/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ export type Fn<A, B> = (x: A) => B;

export type Transducer<A, B> = (rfn: Reducer<any, B>) => Reducer<any, A>;

export type ReductionFn<A, B> = (acc: A, x: B) => A | Reduced<A>;

export interface Reducer<A, B> extends Array<any> {
[0]: () => A;
[1]: (acc: A) => A;
[2]: (acc: A, x: B) => A | Reduced<A>;
[2]: ReductionFn<A, B>;
};

export interface StructField extends Array<any> {
Expand Down

0 comments on commit 45e4993

Please sign in to comment.