mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
More general Transducer definition
This commit is contained in:
7
types/transducers-js/index.d.ts
vendored
7
types/transducers-js/index.d.ts
vendored
@@ -11,7 +11,12 @@ export interface Reduced<TResult> {
|
||||
|
||||
export type Reducer<TResult, TInput> = (result: TResult, input: TInput) => TResult;
|
||||
|
||||
export type Transducer<TInput, TOutput> = <TResult>(xf: Transformer<TResult, TOutput>) => Transformer<TResult, TInput>;
|
||||
// Common case: Transducer<TInput, TOutput> =
|
||||
// Transformer<TResult, TOutput> => Transformer<TResult, TInput>.
|
||||
export type Transducer<TInput, TOutput> =
|
||||
<TResult, TCompleteResult>(
|
||||
xf: CompletingTransformer<TResult, TCompleteResult, TOutput>
|
||||
) => CompletingTransformer<TResult, TCompleteResult, TInput>;
|
||||
|
||||
export interface CompletingTransformer <TResult, TCompleteResult, TInput> {
|
||||
['@@transducer/init'](): TResult | void;
|
||||
|
||||
Reference in New Issue
Block a user