From 389edb875041a419dd5311b55fc25ef9cbdb6ace Mon Sep 17 00:00:00 2001 From: Artur Eshenbrener Date: Fri, 3 Feb 2017 12:39:54 +0300 Subject: [PATCH] observe: Use typescript index types This enables better typecheck and inference. --- src/api/observe.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/observe.ts b/src/api/observe.ts index 4cb0bf41b..c3f3d3dc2 100644 --- a/src/api/observe.ts +++ b/src/api/observe.ts @@ -12,7 +12,7 @@ export function observe(observableArray: IObservableArray, listener: (chan export function observe(observableMap: ObservableMap, listener: (change: IMapChange) => void, fireImmediately?: boolean): Lambda; export function observe(observableMap: ObservableMap, property: string, listener: (change: IValueDidChange) => 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) => void, fireImmediately?: boolean): Lambda; +export function observe(object: T, property: K, listener: (change: IValueDidChange) => void, fireImmediately?: boolean): Lambda; export function observe(thing, propOrCb?, cbOrFire?, fireImmediately?): Lambda { if (typeof cbOrFire === "function") return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);