Skip to content

Commit

Permalink
observe: Use typescript index types
Browse files Browse the repository at this point in the history
This enables better typecheck and inference.
  • Loading branch information
Strate authored Feb 3, 2017
1 parent bc9efb1 commit 389edb8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/api/observe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function observe<T>(observableArray: IObservableArray<T>, listener: (chan
export function observe<T>(observableMap: ObservableMap<T>, listener: (change: IMapChange<T>) => void, fireImmediately?: boolean): Lambda;
export function observe<T>(observableMap: ObservableMap<T>, property: string, listener: (change: IValueDidChange<T>) => void, fireImmediately?: boolean): Lambda;
export function observe(object: Object, listener: (change: IObjectChange) => void, fireImmediately?: boolean): Lambda;
export function observe(object: Object, property: string, listener: (change: IValueDidChange<any>) => void, fireImmediately?: boolean): Lambda;
export function observe<T, K extends keyof T>(object: T, property: K, listener: (change: IValueDidChange<T[K]>) => void, fireImmediately?: boolean): Lambda;
export function observe(thing, propOrCb?, cbOrFire?, fireImmediately?): Lambda {
if (typeof cbOrFire === "function")
return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);
Expand Down

0 comments on commit 389edb8

Please sign in to comment.