mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
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.
This commit is contained in:
Vendored
+7
-3
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user