From dc77ccd8e17758d68393c67dcbf50cca35a124b7 Mon Sep 17 00:00:00 2001 From: DanielM Date: Mon, 29 Aug 2016 17:25:10 +0200 Subject: [PATCH] Add interface to refer to the $onChanges parameter (#10803) The $onChanges method of the IComponentController interface has the type in-lined, making it impossible to refer to it. A new interface was added to encapsulate this type, so that it can be easily used and extended. --- angularjs/angular.d.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index fcfde914e3..111ba86cce 100644 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -1746,12 +1746,12 @@ declare namespace angular { */ $onInit?(): void; /** - * Called whenever one-way bindings are updated. The changesObj is a hash whose keys are the names of the bound - * properties that have changed, and the values are an {@link IChangesObject} object of the form + * Called whenever one-way bindings are updated. The onChangesObj is a hash whose keys are the names of the bound + * properties that have changed, and the values are an {@link IChangesObject} object of the form * { currentValue, previousValue, isFirstChange() }. Use this hook to trigger updates within a component such as * cloning the bound value to prevent accidental mutation of the outer value. */ - $onChanges?(changesObj: {[property:string]: IChangesObject}): void; + $onChanges?(onChangesObj: IOnChangesObject): void; /** * Called on a controller when its containing scope is destroyed. Use this hook for releasing external resources, * watches and event handlers. @@ -1767,6 +1767,10 @@ declare namespace angular { */ $postLink?(): void; } + + interface IOnChangesObject { + [property: string]: IChangesObject; + } interface IChangesObject { currentValue: any;