// Type definitions for IxJS 1.0 // Project: https://github.com/Reactive-Extensions/IxJS // Definitions by: Igor Oleinikov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// declare namespace Ix { export interface Observer { onNext? (value: T): void; onError? (error: Error): void; onCompleted? (): void; } export interface Enumerable { isEmpty(): boolean; minBy(keySelector: (item: T) => TKey, comparer: Comparer): Enumerable; minBy(keySelector: (item: T) => number): Enumerable; maxBy(keySelector: (item: T) => TKey, comparer: Comparer): Enumerable; maxBy(keySelector: (item: T) => number): Enumerable; share(selector: (source: Enumerable) => Enumerable): Enumerable; share(): Enumerable; publish(selector: (source: Enumerable) => Enumerable): Enumerable; publish(): Enumerable; memoize(): Enumerable; do(onNext: (value: T) => void, onError?: (error: Error) => void, onCompleted?: () => void): Enumerable; doAction(onNext: (value: T) => void, onError?: (error: Error) => void, onCompleted?: () => void): Enumerable; do(onbserver: Observer): Enumerable; doAction(onbserver: Observer): Enumerable; bufferWithCount(count: number, skip?: number): Enumerable; ignoreElements(): Enumerable; distinctBy(keySelector: (item: T) => TKey, comparer?: EqualityComparer): Enumerable; distinctUntilChanged(keySelector: (item: T) => TKey, comparer?: EqualityComparer): Enumerable; distinctUntilChanged(): Enumerable; // if need to set comparer without keySelector distinctUntilChanged(_: boolean, comparer: EqualityComparer): Enumerable; expand(selector: (item: T) => Enumerable): Enumerable; startWith(...values: T[]): Enumerable; scan(seed: TAccumulate, accumulate: (acc: TAccumulate, item: T) => TAccumulate): Enumerable; scan(accumulate: (acc: T, item: T) => T): Enumerable; takeLast(count: number): Enumerable; skipLast(count: number): Enumerable; repeat(count?: number): Enumerable; catch(handler: (error: Error) => Enumerable): Enumerable; catchException(handler: (error: Error) => Enumerable): Enumerable; catch(second: Enumerable, ...other: Enumerable[]): Enumerable; catchException(second: Enumerable, ...other: Enumerable[]): Enumerable; // todo: Enumerable>.catch(): Enumerable //catch>(): Enumerable; finally(finallyAction: () => void): Enumerable; finallyDo(finallyAction: () => void): Enumerable; onErrorResumeNext(second: Enumerable): Enumerable; retry(retryCount?: number): Enumerable; } export interface EnumerableStatic { throw(error: Error): Enumerable; throwException(error: Error): Enumerable; defer(enumerableFactory: () => Enumerable): Enumerable; generate( initialState: TState, condition: Predicate, iterate: (state: TState) => TState, resultSelector: (state: TState) => TResult): Enumerable; using( resourceFactory: () => TResource, enumerableFactory: (resource: TResource) => Enumerable): Enumerable; catch(...sources: Enumerable[]): Enumerable; catchException(...sources: Enumerable[]): Enumerable; onErrorResumeNext(...sources: Enumerable[]): Enumerable; while(condition: EnumerablePredicate>, source: Enumerable): Enumerable; whileDo(condition: EnumerablePredicate>, source: Enumerable): Enumerable; if(condition: () => boolean, thenSource: Enumerable, elseSource?: Enumerable): Enumerable; ifThen(condition: () => boolean, thenSource: Enumerable, elseSource?: Enumerable): Enumerable; doWhile(source: Enumerable, condition: EnumerablePredicate>): Enumerable; case(selector: () => number, sources: { [key: number]: Enumerable; }, defaultSource?: Enumerable): Enumerable; case(selector: () => string, sources: { [key: string]: Enumerable; }, defaultSource?: Enumerable): Enumerable; switchCase(selector: () => number, sources: { [key: number]: Enumerable; }, defaultSource?: Enumerable): Enumerable; switchCase(selector: () => string, sources: { [key: string]: Enumerable; }, defaultSource?: Enumerable): Enumerable; for(source: Enumerable, resultSelector: EnumerableFunc): Enumerable; forIn(source: Enumerable, resultSelector: EnumerableFunc): Enumerable; } } declare module "ix" { export = Ix; }