refactor(core): change abstract classes for interfaces (#12324)
BREAKING CHANGE: Because all lifecycle hooks are now interfaces the code that uses 'extends' keyword will no longer compile. To migrate the code follow the example below: Before: ``` @Component() class SomeComponent extends OnInit {} ``` After: ``` @Component() class SomeComponent implements OnInit {} ``` we don't expect anyone to be affected by this change. Closes #10083
This commit is contained in:
parent
a23634dfd0
commit
ee747f7d0c
|
@ -49,7 +49,7 @@ export const LIFECYCLE_HOOKS_VALUES = [
|
||||||
*
|
*
|
||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
export abstract class OnChanges { abstract ngOnChanges(changes: SimpleChanges): void; }
|
export interface OnChanges { ngOnChanges(changes: SimpleChanges): void; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @whatItDoes Lifecycle hook that is called after data-bound properties of a directive are
|
* @whatItDoes Lifecycle hook that is called after data-bound properties of a directive are
|
||||||
|
@ -66,7 +66,7 @@ export abstract class OnChanges { abstract ngOnChanges(changes: SimpleChanges):
|
||||||
*
|
*
|
||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
export abstract class OnInit { abstract ngOnInit(): void; }
|
export interface OnInit { ngOnInit(): void; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @whatItDoes Lifecycle hook that is called when Angular dirty checks a directive.
|
* @whatItDoes Lifecycle hook that is called when Angular dirty checks a directive.
|
||||||
|
@ -89,7 +89,7 @@ export abstract class OnInit { abstract ngOnInit(): void; }
|
||||||
*
|
*
|
||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
export abstract class DoCheck { abstract ngDoCheck(): void; }
|
export interface DoCheck { ngDoCheck(): void; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @whatItDoes Lifecycle hook that is called when a directive, pipe or service is destroyed.
|
* @whatItDoes Lifecycle hook that is called when a directive, pipe or service is destroyed.
|
||||||
|
@ -104,7 +104,7 @@ export abstract class DoCheck { abstract ngDoCheck(): void; }
|
||||||
*
|
*
|
||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
export abstract class OnDestroy { abstract ngOnDestroy(): void; }
|
export interface OnDestroy { ngOnDestroy(): void; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -118,7 +118,7 @@ export abstract class OnDestroy { abstract ngOnDestroy(): void; }
|
||||||
*
|
*
|
||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
export abstract class AfterContentInit { abstract ngAfterContentInit(): void; }
|
export interface AfterContentInit { ngAfterContentInit(): void; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @whatItDoes Lifecycle hook that is called after every check of a directive's content.
|
* @whatItDoes Lifecycle hook that is called after every check of a directive's content.
|
||||||
|
@ -130,7 +130,7 @@ export abstract class AfterContentInit { abstract ngAfterContentInit(): void; }
|
||||||
*
|
*
|
||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
export abstract class AfterContentChecked { abstract ngAfterContentChecked(): void; }
|
export interface AfterContentChecked { ngAfterContentChecked(): void; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @whatItDoes Lifecycle hook that is called after a component's view has been fully
|
* @whatItDoes Lifecycle hook that is called after a component's view has been fully
|
||||||
|
@ -143,7 +143,7 @@ export abstract class AfterContentChecked { abstract ngAfterContentChecked(): vo
|
||||||
*
|
*
|
||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
export abstract class AfterViewInit { abstract ngAfterViewInit(): void; }
|
export interface AfterViewInit { ngAfterViewInit(): void; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @whatItDoes Lifecycle hook that is called after every check of a component's view.
|
* @whatItDoes Lifecycle hook that is called after every check of a component's view.
|
||||||
|
@ -155,4 +155,4 @@ export abstract class AfterViewInit { abstract ngAfterViewInit(): void; }
|
||||||
*
|
*
|
||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
export abstract class AfterViewChecked { abstract ngAfterViewChecked(): void; }
|
export interface AfterViewChecked { ngAfterViewChecked(): void; }
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export declare abstract class AfterContentChecked {
|
export interface AfterContentChecked {
|
||||||
abstract ngAfterContentChecked(): void;
|
ngAfterContentChecked(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export declare abstract class AfterContentInit {
|
export interface AfterContentInit {
|
||||||
abstract ngAfterContentInit(): void;
|
ngAfterContentInit(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export declare abstract class AfterViewChecked {
|
export interface AfterViewChecked {
|
||||||
abstract ngAfterViewChecked(): void;
|
ngAfterViewChecked(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export declare abstract class AfterViewInit {
|
export interface AfterViewInit {
|
||||||
abstract ngAfterViewInit(): void;
|
ngAfterViewInit(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
|
@ -385,8 +385,8 @@ export interface DirectiveDecorator {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export declare abstract class DoCheck {
|
export interface DoCheck {
|
||||||
abstract ngDoCheck(): void;
|
ngDoCheck(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
|
@ -678,18 +678,18 @@ export declare class NgZone {
|
||||||
export declare const NO_ERRORS_SCHEMA: SchemaMetadata;
|
export declare const NO_ERRORS_SCHEMA: SchemaMetadata;
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export declare abstract class OnChanges {
|
export interface OnChanges {
|
||||||
abstract ngOnChanges(changes: SimpleChanges): void;
|
ngOnChanges(changes: SimpleChanges): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export declare abstract class OnDestroy {
|
export interface OnDestroy {
|
||||||
abstract ngOnDestroy(): void;
|
ngOnDestroy(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export declare abstract class OnInit {
|
export interface OnInit {
|
||||||
abstract ngOnInit(): void;
|
ngOnInit(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
|
|
Loading…
Reference in New Issue