From f5a9c4bd4c2c9ea5647179d5c37210fc9809a6db Mon Sep 17 00:00:00 2001 From: David Deutsch Date: Sun, 6 Mar 2016 21:16:36 -0500 Subject: [PATCH] Making return types of $on() and $watch() more specific --- angularjs/angular.d.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index c53a3e1c89..689d7e15a9 100644 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -520,18 +520,18 @@ declare module angular { * @param name Event name to listen on. * @param listener Function to call when the event is emitted. */ - $on(name: string, listener: (event: IAngularEvent, ...args: any[]) => any): Function; + $on(name: string, listener: (event: IAngularEvent, ...args: any[]) => any): () => void; - $watch(watchExpression: string, listener?: string, objectEquality?: boolean): Function; - $watch(watchExpression: string, listener?: (newValue: T, oldValue: T, scope: IScope) => any, objectEquality?: boolean): Function; - $watch(watchExpression: (scope: IScope) => any, listener?: string, objectEquality?: boolean): Function; - $watch(watchExpression: (scope: IScope) => T, listener?: (newValue: T, oldValue: T, scope: IScope) => any, objectEquality?: boolean): Function; + $watch(watchExpression: string, listener?: string, objectEquality?: boolean): () => void; + $watch(watchExpression: string, listener?: (newValue: T, oldValue: T, scope: IScope) => any, objectEquality?: boolean): () => void; + $watch(watchExpression: (scope: IScope) => any, listener?: string, objectEquality?: boolean): () => void; + $watch(watchExpression: (scope: IScope) => T, listener?: (newValue: T, oldValue: T, scope: IScope) => any, objectEquality?: boolean): () => void; - $watchCollection(watchExpression: string, listener: (newValue: T, oldValue: T, scope: IScope) => any): Function; - $watchCollection(watchExpression: (scope: IScope) => T, listener: (newValue: T, oldValue: T, scope: IScope) => any): Function; + $watchCollection(watchExpression: string, listener: (newValue: T, oldValue: T, scope: IScope) => any): () => void; + $watchCollection(watchExpression: (scope: IScope) => T, listener: (newValue: T, oldValue: T, scope: IScope) => any): () => void; - $watchGroup(watchExpressions: any[], listener: (newValue: any, oldValue: any, scope: IScope) => any): Function; - $watchGroup(watchExpressions: { (scope: IScope): any }[], listener: (newValue: any, oldValue: any, scope: IScope) => any): Function; + $watchGroup(watchExpressions: any[], listener: (newValue: any, oldValue: any, scope: IScope) => any): () => void; + $watchGroup(watchExpressions: { (scope: IScope): any }[], listener: (newValue: any, oldValue: any, scope: IScope) => any): () => void; $parent: IScope; $root: IRootScopeService;