From a36f7ae239abe2195c16b1c25e98d6d4904c68b0 Mon Sep 17 00:00:00 2001 From: David Driscoll Date: Sat, 16 Jan 2016 20:22:32 -0500 Subject: [PATCH] style(typings): added enhanced typings for bindCallback --- src/observable/bindCallback.ts | 18 ++++++++++++++++++ src/operator/combineLatest.ts | 16 ++++++++-------- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/observable/bindCallback.ts b/src/observable/bindCallback.ts index 039305de87..034e1d4bcc 100644 --- a/src/observable/bindCallback.ts +++ b/src/observable/bindCallback.ts @@ -9,6 +9,24 @@ import {AsyncSubject} from '../subject/AsyncSubject'; export class BoundCallbackObservable extends Observable { subject: AsyncSubject; + /* tslint:disable:max-line-length */ + static create(callbackFunc: (callback: (result: R) => any) => any, selector?: void, scheduler?: Scheduler): () => Observable; + static create(callbackFunc: (v1: T, callback: (result: R) => any) => any, selector?: void, scheduler?: Scheduler): (v1: T) => Observable; + static create(callbackFunc: (v1: T, v2: T2, callback: (result: R) => any) => any, selector?: void, scheduler?: Scheduler): (v1: T, v2: T2) => Observable; + static create(callbackFunc: (v1: T, v2: T2, v3: T3, callback: (result: R) => any) => any, selector?: void, scheduler?: Scheduler): (v1: T, v2: T2, v3: T3) => Observable; + static create(callbackFunc: (v1: T, v2: T2, v3: T3, v4: T4, callback: (result: R) => any) => any, selector?: void, scheduler?: Scheduler): (v1: T, v2: T2, v3: T3, v4: T4) => Observable; + static create(callbackFunc: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5, callback: (result: R) => any) => any, selector?: void, scheduler?: Scheduler): (v1: T, v2: T2, v3: T3, v4: T4, v5: T5) => Observable; + static create(callbackFunc: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, callback: (result: R) => any) => any, selector?: void, scheduler?: Scheduler): (v1: T, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6) => Observable; + static create(callbackFunc: (callback: (...args: any[]) => any) => any, selector: (...args: any[]) => R, scheduler?: Scheduler): () => Observable; + static create(callbackFunc: (v1: T, callback: (...args: any[]) => any) => any, selector: (...args: any[]) => R, scheduler?: Scheduler): (v1: T) => Observable; + static create(callbackFunc: (v1: T, v2: T2, callback: (...args: any[]) => any) => any, selector: (...args: any[]) => R, scheduler?: Scheduler): (v1: T, v2: T2) => Observable; + static create(callbackFunc: (v1: T, v2: T2, v3: T3, callback: (...args: any[]) => any) => any, selector: (...args: any[]) => R, scheduler?: Scheduler): (v1: T, v2: T2, v3: T3) => Observable; + static create(callbackFunc: (v1: T, v2: T2, v3: T3, v4: T4, callback: (...args: any[]) => any) => any, selector: (...args: any[]) => R, scheduler?: Scheduler): (v1: T, v2: T2, v3: T3, v4: T4) => Observable; + static create(callbackFunc: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5, callback: (...args: any[]) => any) => any, selector: (...args: any[]) => R, scheduler?: Scheduler): (v1: T, v2: T2, v3: T3, v4: T4, v5: T5) => Observable; + static create(callbackFunc: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, callback: (...args: any[]) => any) => any, selector: (...args: any[]) => R, scheduler?: Scheduler): (v1: T, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6) => Observable; + static create(callbackFunc: Function, selector?: void, scheduler?: Scheduler): (...args: any[]) => Observable; + static create(callbackFunc: Function, selector?: (...args: any[]) => T, scheduler?: Scheduler): (...args: any[]) => Observable; + /* tslint:enable:max-line-length */ static create(callbackFunc: Function, selector: Function | void = undefined, scheduler?: Scheduler): (...args: any[]) => Observable { diff --git a/src/operator/combineLatest.ts b/src/operator/combineLatest.ts index 22807c228a..ef62dac772 100644 --- a/src/operator/combineLatest.ts +++ b/src/operator/combineLatest.ts @@ -13,8 +13,8 @@ import {isArray} from '../util/isArray'; * @returns {Observable} an observable of other projected values from the most recent values from each observable, or an array of each of * the most recent values from each observable. */ -export function combineLatest(...observables: Array | - Array> | +export function combineLatest(...observables: Array | + Array> | ((...values: Array) => R)>): Observable { let project: (...values: Array) => R = null; if (typeof observables[observables.length - 1] === 'function') { @@ -34,12 +34,6 @@ export function combineLatest(...observables: Array | /* tslint:disable:max-line-length */ export interface CombineLatestSignature { - (v2: ObservableInput): Observable<[T, T2]>; - (v2: ObservableInput, v3: ObservableInput): Observable<[T, T2, T3]>; - (v2: ObservableInput, v3: ObservableInput, v4: ObservableInput): Observable<[T, T2, T3, T4]>; - (v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput): Observable<[T, T2, T3, T4, T5]>; - (v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput, v6: ObservableInput): Observable<[T, T2, T3, T4, T5, T6]>; - (project: (v1: T) => R): Observable; (v2: ObservableInput, project: (v1: T, v2: T2) => R): Observable; (v2: ObservableInput, v3: ObservableInput, project: (v1: T, v2: T2, v3: T3) => R): Observable; @@ -47,6 +41,12 @@ export interface CombineLatestSignature { (v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput, project: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5) => R): Observable; (v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput, v6: ObservableInput, project: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6) => R): Observable; + (v2: ObservableInput): Observable<[T, T2]>; + (v2: ObservableInput, v3: ObservableInput): Observable<[T, T2, T3]>; + (v2: ObservableInput, v3: ObservableInput, v4: ObservableInput): Observable<[T, T2, T3, T4]>; + (v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput): Observable<[T, T2, T3, T4, T5]>; + (v2: ObservableInput, v3: ObservableInput, v4: ObservableInput, v5: ObservableInput, v6: ObservableInput): Observable<[T, T2, T3, T4, T5, T6]>; + (...observables: Array | ((...values: Array) => R)>): Observable; (array: ObservableInput[]): Observable; (array: ObservableInput[], project: (...values: Array) => R): Observable;