diff --git a/packages/core/schematics/migrations/missing-injectable/providers_evaluator.ts b/packages/core/schematics/migrations/missing-injectable/providers_evaluator.ts index c3fd96ae47..8399fc8360 100644 --- a/packages/core/schematics/migrations/missing-injectable/providers_evaluator.ts +++ b/packages/core/schematics/migrations/missing-injectable/providers_evaluator.ts @@ -28,7 +28,7 @@ export interface ProviderLiteral { export class ProvidersEvaluator extends StaticInterpreter { private _providerLiterals: ProviderLiteral[] = []; - visitObjectLiteralExpression(node: ts.ObjectLiteralExpression, context: any) { + override visitObjectLiteralExpression(node: ts.ObjectLiteralExpression, context: any) { const resolvedValue = super.visitObjectLiteralExpression(node, {...context, insideProviderDef: true}); // do not collect nested object literals. e.g. a provider could use a diff --git a/packages/core/schematics/migrations/static-queries/strategies/usage_strategy/template_usage_visitor.ts b/packages/core/schematics/migrations/static-queries/strategies/usage_strategy/template_usage_visitor.ts index 0d174244fa..136cc957aa 100644 --- a/packages/core/schematics/migrations/static-queries/strategies/usage_strategy/template_usage_visitor.ts +++ b/packages/core/schematics/migrations/static-queries/strategies/usage_strategy/template_usage_visitor.ts @@ -32,7 +32,7 @@ export class TemplateUsageVisitor extends NullVisitor { return !this.hasQueryTemplateReference && this.expressionAstVisitor.hasQueryPropertyRead; } - visitElement(element: Element): void { + override visitElement(element: Element): void { // In case there is a template references variable that matches the query property // name, we can finish this visitor as such a template variable can be used in the // entire template and the query therefore can't be accessed from the template. @@ -47,7 +47,7 @@ export class TemplateUsageVisitor extends NullVisitor { visitAll(this, element.children); } - visitTemplate(template: Template): void { + override visitTemplate(template: Template): void { visitAll(this, template.attributes); visitAll(this, template.inputs); visitAll(this, template.outputs); @@ -57,15 +57,15 @@ export class TemplateUsageVisitor extends NullVisitor { // lifecycle hook at the earliest. } - visitBoundAttribute(attribute: BoundAttribute) { + override visitBoundAttribute(attribute: BoundAttribute) { attribute.value.visit(this.expressionAstVisitor, attribute.sourceSpan); } - visitBoundText(text: BoundText) { + override visitBoundText(text: BoundText) { text.value.visit(this.expressionAstVisitor, text.sourceSpan); } - visitBoundEvent(node: BoundEvent) { + override visitBoundEvent(node: BoundEvent) { node.handler.visit(this.expressionAstVisitor, node.handlerSpan); } } @@ -81,7 +81,7 @@ class ExpressionAstVisitor extends RecursiveAstVisitor { super(); } - visitPropertyRead(node: PropertyRead, span: ParseSourceSpan): any { + override visitPropertyRead(node: PropertyRead, span: ParseSourceSpan): any { // The receiver of the property read needs to be "implicit" as queries are accessed // from the component instance and not from other objects. if (node.receiver instanceof ImplicitReceiver && node.name === this.queryPropertyName) { diff --git a/packages/core/schematics/migrations/template-var-assignment/angular/html_variable_assignment_visitor.ts b/packages/core/schematics/migrations/template-var-assignment/angular/html_variable_assignment_visitor.ts index faa2193985..719c87ca08 100644 --- a/packages/core/schematics/migrations/template-var-assignment/angular/html_variable_assignment_visitor.ts +++ b/packages/core/schematics/migrations/template-var-assignment/angular/html_variable_assignment_visitor.ts @@ -26,12 +26,12 @@ export class HtmlVariableAssignmentVisitor extends NullVisitor { private expressionAstVisitor = new ExpressionAstVisitor(this.variableAssignments, this.currentVariables); - visitElement(element: Element): void { + override visitElement(element: Element): void { visitAll(this, element.outputs); visitAll(this, element.children); } - visitTemplate(template: Template): void { + override visitTemplate(template: Template): void { // Keep track of the template variables which can be accessed by the template // child nodes through the implicit receiver. this.currentVariables.push(...template.variables); @@ -52,7 +52,7 @@ export class HtmlVariableAssignmentVisitor extends NullVisitor { }); } - visitBoundEvent(node: BoundEvent) { + override visitBoundEvent(node: BoundEvent) { node.handler.visit(this.expressionAstVisitor, node.handlerSpan); } } @@ -65,7 +65,7 @@ class ExpressionAstVisitor extends RecursiveAstVisitor { super(); } - visitPropertyWrite(node: PropertyWrite, span: ParseSourceSpan) { + override visitPropertyWrite(node: PropertyWrite, span: ParseSourceSpan) { if (node.receiver instanceof ImplicitReceiver && this.currentVariables.some(v => v.name === node.name)) { this.variableAssignments.push({ diff --git a/packages/core/src/compiler/compiler_facade_interface.ts b/packages/core/src/compiler/compiler_facade_interface.ts index 3bfb7d2fc1..14ac1a341b 100644 --- a/packages/core/src/compiler/compiler_facade_interface.ts +++ b/packages/core/src/compiler/compiler_facade_interface.ts @@ -63,7 +63,9 @@ export interface CompilerFacade { createParseSourceSpan(kind: string, typeName: string, sourceUrl: string): ParseSourceSpan; FactoryTarget: typeof FactoryTarget; - ResourceLoader: {new(): ResourceLoader}; + // Note that we do not use `{new(): ResourceLoader}` here because + // the resource loader class is abstract and not constructable. + ResourceLoader: Function&{prototype: ResourceLoader}; } export interface CoreEnvironment { diff --git a/packages/core/src/event_emitter.ts b/packages/core/src/event_emitter.ts index 3136af5f9e..a7eea17c14 100644 --- a/packages/core/src/event_emitter.ts +++ b/packages/core/src/event_emitter.ts @@ -114,7 +114,7 @@ class EventEmitter_ extends Subject { super.next(value); } - subscribe(observerOrNext?: any, error?: any, complete?: any): Subscription { + override subscribe(observerOrNext?: any, error?: any, complete?: any): Subscription { let nextFn = observerOrNext; let errorFn = error || (() => null); let completeFn = complete; diff --git a/packages/core/src/render3/view_ref.ts b/packages/core/src/render3/view_ref.ts index c7026fb06f..69d171c8b3 100644 --- a/packages/core/src/render3/view_ref.ts +++ b/packages/core/src/render3/view_ref.ts @@ -308,15 +308,15 @@ export class RootViewRef extends ViewRef { super(_view); } - detectChanges(): void { + override detectChanges(): void { detectChangesInRootView(this._view); } - checkNoChanges(): void { + override checkNoChanges(): void { checkNoChangesInRootView(this._view); } - get context(): T { + override get context(): T { return null!; } } diff --git a/packages/core/test/acceptance/change_detection_spec.ts b/packages/core/test/acceptance/change_detection_spec.ts index 36b07659ed..a360a5b581 100644 --- a/packages/core/test/acceptance/change_detection_spec.ts +++ b/packages/core/test/acceptance/change_detection_spec.ts @@ -1189,7 +1189,7 @@ describe('change detection', () => { // Custom error handler that just rethrows all the errors from the // view, rather than logging them out. Used to keep our logs clean. class RethrowErrorHandler extends ErrorHandler { - handleError(error: any) { + override handleError(error: any) { throw error; } } diff --git a/packages/core/test/acceptance/change_detection_transplanted_view_spec.ts b/packages/core/test/acceptance/change_detection_transplanted_view_spec.ts index 815aebcb5c..235e6933da 100644 --- a/packages/core/test/acceptance/change_detection_transplanted_view_spec.ts +++ b/packages/core/test/acceptance/change_detection_transplanted_view_spec.ts @@ -54,11 +54,11 @@ describe('change detection for transplanted views', () => { template: insertCompTemplate, }) class InsertForOnPushDeclareComp extends InsertComp { - constructor(public changeDetectorRef: ChangeDetectorRef) { + constructor(changeDetectorRef: ChangeDetectorRef) { super(changeDetectorRef); insertForOnPushDeclareComp = this; } - get template(): TemplateRef { + override get template(): TemplateRef { return onPushDeclareComp.myTmpl; } } @@ -105,7 +105,7 @@ describe('change detection for transplanted views', () => { changeDetection: ChangeDetectionStrategy.OnPush }) class OnPushDeclareComp extends DeclareComp { - constructor(readonly changeDetector: ChangeDetectorRef) { + constructor(changeDetector: ChangeDetectorRef) { super(changeDetector); onPushDeclareComp = this; } diff --git a/packages/core/test/acceptance/copy_definition_feature_spec.ts b/packages/core/test/acceptance/copy_definition_feature_spec.ts index 36bfa2d0de..35a74ae42f 100644 --- a/packages/core/test/acceptance/copy_definition_feature_spec.ts +++ b/packages/core/test/acceptance/copy_definition_feature_spec.ts @@ -40,7 +40,7 @@ describe('Ivy CopyDefinitionFeature', () => { } class ChildComponent extends BaseComponent { - static ɵcmp = defineComponent({ + static override ɵcmp = defineComponent({ type: ChildComponent, selectors: [['some-cmp']], features: [InheritDefinitionFeature, CopyDefinitionFeature], @@ -49,7 +49,7 @@ describe('Ivy CopyDefinitionFeature', () => { template: function ChildComponent_Template(rf, ctx) {}, encapsulation: 2 }); - static ɵfac = function ChildComponent_Factory(t: any) { + static override ɵfac = function ChildComponent_Factory(t: any) { return new (t || ChildComponent)(); }; } diff --git a/packages/core/test/acceptance/di_spec.ts b/packages/core/test/acceptance/di_spec.ts index 69cda5ce1b..7c1001e48a 100644 --- a/packages/core/test/acceptance/di_spec.ts +++ b/packages/core/test/acceptance/di_spec.ts @@ -2040,7 +2040,7 @@ describe('di', () => { } class MyRootService extends MyService { - id = 2; + override id = 2; } @Component({template: ''}) diff --git a/packages/core/test/acceptance/inherit_definition_feature_spec.ts b/packages/core/test/acceptance/inherit_definition_feature_spec.ts index 876fc4c23f..6a36e60771 100644 --- a/packages/core/test/acceptance/inherit_definition_feature_spec.ts +++ b/packages/core/test/acceptance/inherit_definition_feature_spec.ts @@ -321,7 +321,7 @@ describe('inheritance', () => { } abstract class UndecoratedBase extends Base { - abstract input: any; + abstract override input: any; ngOnChanges() { changes++; } @@ -383,7 +383,7 @@ describe('inheritance', () => { selector: '[subDir]', }) class SubDirective extends SuperDirective { - ngOnInit() { + override ngOnInit() { fired.push('sub init'); } } @@ -424,7 +424,7 @@ describe('inheritance', () => { selector: '[subDir]', }) class SubDirective extends SuperDirective { - ngDoCheck() { + override ngDoCheck() { fired.push('sub do check'); } } @@ -465,7 +465,7 @@ describe('inheritance', () => { selector: '[subDir]', }) class SubDirective extends SuperDirective { - ngAfterContentInit() { + override ngAfterContentInit() { fired.push('sub after content init'); } } @@ -506,7 +506,7 @@ describe('inheritance', () => { selector: '[subDir]', }) class SubDirective extends SuperDirective { - ngAfterContentChecked() { + override ngAfterContentChecked() { fired.push('sub after content checked'); } } @@ -547,7 +547,7 @@ describe('inheritance', () => { selector: '[subDir]', }) class SubDirective extends SuperDirective { - ngAfterViewInit() { + override ngAfterViewInit() { fired.push('sub after view init'); } } @@ -588,7 +588,7 @@ describe('inheritance', () => { selector: '[subDir]', }) class SubDirective extends SuperDirective { - ngAfterViewChecked() { + override ngAfterViewChecked() { fired.push('sub after view checked'); } } @@ -629,7 +629,7 @@ describe('inheritance', () => { selector: '[subDir]', }) class SubDirective extends SuperDirective { - ngOnDestroy() { + override ngOnDestroy() { fired.push('sub destroy'); } } @@ -684,7 +684,7 @@ describe('inheritance', () => { selector: '[sub-dir]', }) class SubDirective extends SuperDirective { - @Input() baz = ''; + @Input() override baz = ''; @Input() qux = ''; } @@ -943,7 +943,7 @@ describe('inheritance', () => { selector: '[subDir]', }) class SubDirective extends SuperDirective { - ngOnInit() { + override ngOnInit() { fired.push('sub init'); } } @@ -984,7 +984,7 @@ describe('inheritance', () => { selector: '[subDir]', }) class SubDirective extends SuperDirective { - ngDoCheck() { + override ngDoCheck() { fired.push('sub do check'); } } @@ -1025,7 +1025,7 @@ describe('inheritance', () => { selector: '[subDir]', }) class SubDirective extends SuperDirective { - ngAfterContentInit() { + override ngAfterContentInit() { fired.push('sub after content init'); } } @@ -1066,7 +1066,7 @@ describe('inheritance', () => { selector: '[subDir]', }) class SubDirective extends SuperDirective { - ngAfterContentChecked() { + override ngAfterContentChecked() { fired.push('sub after content checked'); } } @@ -1107,7 +1107,7 @@ describe('inheritance', () => { selector: '[subDir]', }) class SubDirective extends SuperDirective { - ngAfterViewInit() { + override ngAfterViewInit() { fired.push('sub after view init'); } } @@ -1148,7 +1148,7 @@ describe('inheritance', () => { selector: '[subDir]', }) class SubDirective extends SuperDirective { - ngAfterViewChecked() { + override ngAfterViewChecked() { fired.push('sub after view checked'); } } @@ -1189,7 +1189,7 @@ describe('inheritance', () => { selector: '[subDir]', }) class SubDirective extends SuperDirective { - ngOnDestroy() { + override ngOnDestroy() { fired.push('sub destroy'); } } @@ -1245,7 +1245,7 @@ describe('inheritance', () => { selector: '[sub-dir]', }) class SubDirective extends SuperDirective { - @Input() baz = ''; + @Input() override baz = ''; @Input() qux = ''; } @@ -1513,7 +1513,7 @@ describe('inheritance', () => { selector: '[subDir]', }) class SubDirective extends SuperDirective { - ngOnInit() { + override ngOnInit() { fired.push('sub init'); } } @@ -1554,7 +1554,7 @@ describe('inheritance', () => { selector: '[subDir]', }) class SubDirective extends SuperDirective { - ngDoCheck() { + override ngDoCheck() { fired.push('sub do check'); } } @@ -1595,7 +1595,7 @@ describe('inheritance', () => { selector: '[subDir]', }) class SubDirective extends SuperDirective { - ngAfterContentInit() { + override ngAfterContentInit() { fired.push('sub after content init'); } } @@ -1636,7 +1636,7 @@ describe('inheritance', () => { selector: '[subDir]', }) class SubDirective extends SuperDirective { - ngAfterContentChecked() { + override ngAfterContentChecked() { fired.push('sub after content checked'); } } @@ -1677,7 +1677,7 @@ describe('inheritance', () => { selector: '[subDir]', }) class SubDirective extends SuperDirective { - ngAfterViewInit() { + override ngAfterViewInit() { fired.push('sub after view init'); } } @@ -1718,7 +1718,7 @@ describe('inheritance', () => { selector: '[subDir]', }) class SubDirective extends SuperDirective { - ngAfterViewChecked() { + override ngAfterViewChecked() { fired.push('sub after view checked'); } } @@ -1759,7 +1759,7 @@ describe('inheritance', () => { selector: '[subDir]', }) class SubDirective extends SuperDirective { - ngOnDestroy() { + override ngOnDestroy() { fired.push('sub destroy'); } } @@ -1817,7 +1817,7 @@ describe('inheritance', () => { selector: '[sub-dir]', }) class SubDirective extends SuperDirective { - @Input() baz = ''; + @Input() override baz = ''; @Input() qux = ''; } @@ -2118,7 +2118,7 @@ describe('inheritance', () => { it('ngOnInit', () => { @Component({selector: 'my-comp', template: `

test

`}) class MyComponent extends SuperComponent { - ngOnInit() { + override ngOnInit() { fired.push('sub init'); } } @@ -2159,7 +2159,7 @@ describe('inheritance', () => { selector: 'my-comp', }) class MyComponent extends SuperComponent { - ngDoCheck() { + override ngDoCheck() { fired.push('sub do check'); } } @@ -2201,7 +2201,7 @@ describe('inheritance', () => { template: `

test

`, }) class MyComponent extends SuperComponent { - ngAfterContentInit() { + override ngAfterContentInit() { fired.push('sub after content init'); } } @@ -2243,7 +2243,7 @@ describe('inheritance', () => { template: `

test

`, }) class MyComponent extends SuperComponent { - ngAfterContentChecked() { + override ngAfterContentChecked() { fired.push('sub after content checked'); } } @@ -2285,7 +2285,7 @@ describe('inheritance', () => { template: `

test

`, }) class MyComponent extends SuperComponent { - ngAfterViewInit() { + override ngAfterViewInit() { fired.push('sub after view init'); } } @@ -2327,7 +2327,7 @@ describe('inheritance', () => { template: `

test

`, }) class MyComponent extends SuperComponent { - ngAfterViewChecked() { + override ngAfterViewChecked() { fired.push('sub after view checked'); } } @@ -2369,7 +2369,7 @@ describe('inheritance', () => { template: `

test

`, }) class MyComponent extends SuperComponent { - ngOnDestroy() { + override ngOnDestroy() { fired.push('sub destroy'); } } @@ -2422,7 +2422,7 @@ describe('inheritance', () => { @Component({selector: 'my-comp', template: `

test

`}) class MyComponent extends SuperComponent { - @Input() baz = ''; + @Input() override baz = ''; @Input() qux = ''; } @@ -2675,7 +2675,7 @@ describe('inheritance', () => { it('ngOnInit', () => { @Component({selector: 'my-comp', template: `

test

`}) class MyComponent extends SuperDirective { - ngOnInit() { + override ngOnInit() { fired.push('sub init'); } } @@ -2717,7 +2717,7 @@ describe('inheritance', () => { template: `

test

`, }) class MyComponent extends SuperDirective { - ngDoCheck() { + override ngDoCheck() { fired.push('sub do check'); } } @@ -2759,7 +2759,7 @@ describe('inheritance', () => { template: `

test

`, }) class MyComponent extends SuperDirective { - ngAfterContentInit() { + override ngAfterContentInit() { fired.push('sub after content init'); } } @@ -2801,7 +2801,7 @@ describe('inheritance', () => { template: `

test

`, }) class MyComponent extends SuperDirective { - ngAfterContentChecked() { + override ngAfterContentChecked() { fired.push('sub after content checked'); } } @@ -2843,7 +2843,7 @@ describe('inheritance', () => { template: `

test

`, }) class MyComponent extends SuperDirective { - ngAfterViewInit() { + override ngAfterViewInit() { fired.push('sub after view init'); } } @@ -2885,7 +2885,7 @@ describe('inheritance', () => { template: `

test

`, }) class MyComponent extends SuperDirective { - ngAfterViewChecked() { + override ngAfterViewChecked() { fired.push('sub after view checked'); } } @@ -2927,7 +2927,7 @@ describe('inheritance', () => { template: `

test

`, }) class MyComponent extends SuperDirective { - ngOnDestroy() { + override ngOnDestroy() { fired.push('sub destroy'); } } @@ -2983,7 +2983,7 @@ describe('inheritance', () => { @Component({selector: 'my-comp', template: `

test

`}) class MyComponent extends SuperDirective { - @Input() baz = ''; + @Input() override baz = ''; @Input() qux = ''; } @@ -3296,7 +3296,7 @@ describe('inheritance', () => { it('ngOnInit', () => { @Component({selector: 'my-comp', template: `

test

`}) class MyComponent extends BareClass { - ngOnInit() { + override ngOnInit() { fired.push('sub init'); } } @@ -3337,7 +3337,7 @@ describe('inheritance', () => { selector: 'my-comp', }) class MyComponent extends BareClass { - ngDoCheck() { + override ngDoCheck() { fired.push('sub do check'); } } @@ -3379,7 +3379,7 @@ describe('inheritance', () => { template: `

test

`, }) class MyComponent extends BareClass { - ngAfterContentInit() { + override ngAfterContentInit() { fired.push('sub after content init'); } } @@ -3421,7 +3421,7 @@ describe('inheritance', () => { template: `

test

`, }) class MyComponent extends BareClass { - ngAfterContentChecked() { + override ngAfterContentChecked() { fired.push('sub after content checked'); } } @@ -3463,7 +3463,7 @@ describe('inheritance', () => { template: `

test

`, }) class MyComponent extends BareClass { - ngAfterViewInit() { + override ngAfterViewInit() { fired.push('sub after view init'); } } @@ -3505,7 +3505,7 @@ describe('inheritance', () => { template: `

test

`, }) class MyComponent extends BareClass { - ngAfterViewChecked() { + override ngAfterViewChecked() { fired.push('sub after view checked'); } } @@ -3547,7 +3547,7 @@ describe('inheritance', () => { template: `

test

`, }) class MyComponent extends BareClass { - ngOnDestroy() { + override ngOnDestroy() { fired.push('sub destroy'); } } @@ -3605,7 +3605,7 @@ describe('inheritance', () => { @Component({selector: 'my-comp', template: `

test

`}) class MyComponent extends BareClass { - @Input() baz = ''; + @Input() override baz = ''; @Input() qux = ''; } @@ -3941,7 +3941,7 @@ describe('inheritance', () => { template: `

test

`, }) class MyComponent extends SuperComponent { - ngOnInit() { + override ngOnInit() { fired.push('sub init'); } } @@ -3983,7 +3983,7 @@ describe('inheritance', () => { template: `

test

`, }) class MyComponent extends SuperComponent { - ngDoCheck() { + override ngDoCheck() { fired.push('sub do check'); } } @@ -4025,7 +4025,7 @@ describe('inheritance', () => { template: `

test

`, }) class MyComponent extends SuperComponent { - ngAfterContentInit() { + override ngAfterContentInit() { fired.push('sub after content init'); } } @@ -4067,7 +4067,7 @@ describe('inheritance', () => { template: `

test

`, }) class MyComponent extends SuperComponent { - ngAfterContentChecked() { + override ngAfterContentChecked() { fired.push('sub after content checked'); } } @@ -4109,7 +4109,7 @@ describe('inheritance', () => { template: `

test

`, }) class MyComponent extends SuperComponent { - ngAfterViewInit() { + override ngAfterViewInit() { fired.push('sub after view init'); } } @@ -4151,7 +4151,7 @@ describe('inheritance', () => { template: `

test

`, }) class MyComponent extends SuperComponent { - ngAfterViewChecked() { + override ngAfterViewChecked() { fired.push('sub after view checked'); } } @@ -4193,7 +4193,7 @@ describe('inheritance', () => { template: `

test

`, }) class MyComponent extends SuperComponent { - ngOnDestroy() { + override ngOnDestroy() { fired.push('sub destroy'); } } @@ -4250,7 +4250,7 @@ describe('inheritance', () => { @Component({selector: 'my-comp', template: `

test

`}) class MyComponent extends SuperComponent { - @Input() baz = ''; + @Input() override baz = ''; @Input() qux = ''; } @@ -4623,7 +4623,7 @@ describe('inheritance', () => { focused() { } - clicked() { + override clicked() { events.push('ChildComponent.clicked'); } } @@ -4640,7 +4640,7 @@ describe('inheritance', () => { blurred() { } - clicked() { + override clicked() { events.push('GrandChildComponent.clicked'); } } @@ -4741,7 +4741,7 @@ describe('inheritance', () => { template: `

test

`, }) class MyComponent extends SuperComponent { - ngOnInit() { + override ngOnInit() { fired.push('sub init'); } } @@ -4783,7 +4783,7 @@ describe('inheritance', () => { template: `

test

`, }) class MyComponent extends SuperComponent { - ngDoCheck() { + override ngDoCheck() { fired.push('sub do check'); } } @@ -4825,7 +4825,7 @@ describe('inheritance', () => { template: `

test

`, }) class MyComponent extends SuperComponent { - ngAfterContentInit() { + override ngAfterContentInit() { fired.push('sub after content init'); } } @@ -4867,7 +4867,7 @@ describe('inheritance', () => { template: `

test

`, }) class MyComponent extends SuperComponent { - ngAfterContentChecked() { + override ngAfterContentChecked() { fired.push('sub after content checked'); } } @@ -4909,7 +4909,7 @@ describe('inheritance', () => { template: `

test

`, }) class MyComponent extends SuperComponent { - ngAfterViewInit() { + override ngAfterViewInit() { fired.push('sub after view init'); } } @@ -4951,7 +4951,7 @@ describe('inheritance', () => { template: `

test

`, }) class MyComponent extends SuperComponent { - ngAfterViewChecked() { + override ngAfterViewChecked() { fired.push('sub after view checked'); } } @@ -4993,7 +4993,7 @@ describe('inheritance', () => { template: `

test

`, }) class MyComponent extends SuperComponent { - ngOnDestroy() { + override ngOnDestroy() { fired.push('sub destroy'); } } @@ -5052,7 +5052,7 @@ describe('inheritance', () => { @Component({selector: 'my-comp', template: `

test

`}) class MyComponent extends BareClass { - @Input() baz = ''; + @Input() override baz = ''; @Input() qux = ''; } @@ -5182,8 +5182,8 @@ describe('inheritance', () => { ], }) class MyComponent extends IntermediateComponent { - colorExp = 'color'; - opacityExp = 'opacity'; + override colorExp = 'color'; + override opacityExp = 'opacity'; bgExp = 'bg'; } diff --git a/packages/core/test/acceptance/lifecycle_spec.ts b/packages/core/test/acceptance/lifecycle_spec.ts index e322a78aeb..1bd6ccd4e1 100644 --- a/packages/core/test/acceptance/lifecycle_spec.ts +++ b/packages/core/test/acceptance/lifecycle_spec.ts @@ -1253,17 +1253,17 @@ it('should call all hooks in correct order when several directives on same node' @Directive({selector: 'div'}) class DirA extends AllHooks { - @Input('a') id: number = 0; + @Input('a') override id: number = 0; } @Directive({selector: 'div'}) class DirB extends AllHooks { - @Input('b') id: number = 0; + @Input('b') override id: number = 0; } @Directive({selector: 'div'}) class DirC extends AllHooks { - @Input('c') id: number = 0; + @Input('c') override id: number = 0; } @Component({selector: 'app-comp', template: '
'}) diff --git a/packages/core/test/acceptance/listener_spec.ts b/packages/core/test/acceptance/listener_spec.ts index 597d830d03..fe574c23e5 100644 --- a/packages/core/test/acceptance/listener_spec.ts +++ b/packages/core/test/acceptance/listener_spec.ts @@ -155,7 +155,7 @@ describe('event listeners', () => { let noOfErrors = 0; class CountingErrorHandler extends ErrorHandler { - handleError(error: any): void { + override handleError(error: any): void { noOfErrors++; } } diff --git a/packages/core/test/di/static_injector_spec.ts b/packages/core/test/di/static_injector_spec.ts index 3106edd9a5..5098e08814 100644 --- a/packages/core/test/di/static_injector_spec.ts +++ b/packages/core/test/di/static_injector_spec.ts @@ -33,7 +33,7 @@ class Dashboard { } class TurboEngine extends Engine { - static PROVIDER = {provide: Engine, useClass: TurboEngine, deps: []}; + static override PROVIDER = {provide: Engine, useClass: TurboEngine, deps: []}; } class Car { @@ -65,7 +65,7 @@ class CarWithDashboard { } class SportsCar extends Car { - static PROVIDER = {provide: Car, useClass: SportsCar, deps: [Engine]}; + static override PROVIDER = {provide: Car, useClass: SportsCar, deps: [Engine]}; } class CyclicEngine { diff --git a/packages/core/test/linker/source_map_integration_node_only_spec.ts b/packages/core/test/linker/source_map_integration_node_only_spec.ts index 256fbf0e41..0b8ac82f4b 100644 --- a/packages/core/test/linker/source_map_integration_node_only_spec.ts +++ b/packages/core/test/linker/source_map_integration_node_only_spec.ts @@ -477,7 +477,7 @@ describe('jit source mapping', () => { class MockJitEvaluator extends JitEvaluator { sources: string[] = []; - executeFunction(fn: Function, args: any[]) { + override executeFunction(fn: Function, args: any[]) { // Capture the source that has been generated. this.sources.push(fn.toString()); // Then execute it anyway. diff --git a/packages/core/test/reflection/reflector_spec.ts b/packages/core/test/reflection/reflector_spec.ts index 137edb7f88..556182c4cd 100644 --- a/packages/core/test/reflection/reflector_spec.ts +++ b/packages/core/test/reflection/reflector_spec.ts @@ -423,7 +423,7 @@ class TestObj { class Child extends Parent { // TODO(issue/24571): remove '!'. - @PropDecorator('b2') b!: B; + @PropDecorator('b2') override b!: B; // TODO(issue/24571): remove '!'. @PropDecorator('c') c!: C; } @@ -455,7 +455,7 @@ class TestObj { } class Child extends Parent { - hook2() {} + override hook2() {} hook3() {} } @@ -477,7 +477,7 @@ class TestObj { } class Child extends Parent { - static decorators = [{type: ClassDecorator, args: [{value: 'child'}]}]; + static override decorators = [{type: ClassDecorator, args: [{value: 'child'}]}]; } class ChildNoDecorators extends Parent {} @@ -508,7 +508,7 @@ class TestObj { class Child extends Parent {} class ChildWithCtor extends Parent { - static ctorParameters = () => + static override ctorParameters = () => [{type: C, decorators: [{type: ParamDecorator, args: ['c']}]}, ] constructor() { @@ -541,7 +541,7 @@ class TestObj { } class Child extends Parent { - static propDecorators: any = { + static override propDecorators: any = { 'b': [{type: PropDecorator, args: ['b2']}], 'c': [{type: PropDecorator, args: ['c']}], }; @@ -568,7 +568,7 @@ class TestObj { } class Child extends Parent { - static annotations = [new ClassDecorator({value: 'child'})]; + static override annotations = [new ClassDecorator({value: 'child'})]; } class ChildNoDecorators extends Parent {} @@ -599,7 +599,7 @@ class TestObj { class Child extends Parent {} class ChildWithCtor extends Parent { - static parameters = [ + static override parameters = [ [C, new ParamDecorator('c')], ]; constructor() { @@ -632,7 +632,7 @@ class TestObj { } class Child extends Parent { - static propMetadata: any = { + static override propMetadata: any = { 'b': [new PropDecorator('b2')], 'c': [new PropDecorator('c')], }; diff --git a/packages/core/test/render3/jit/declare_factory_spec.ts b/packages/core/test/render3/jit/declare_factory_spec.ts index 29c4f3a4bd..c3bf765a8d 100644 --- a/packages/core/test/render3/jit/declare_factory_spec.ts +++ b/packages/core/test/render3/jit/declare_factory_spec.ts @@ -52,7 +52,7 @@ class DependingClass { } class ChildClass extends DependingClass { - static ɵfac = + static override ɵfac = ɵɵngDeclareFactory({type: ChildClass, deps: null, target: ɵɵFactoryTarget.Injectable}); } diff --git a/packages/core/test/render3/pipe_spec.ts b/packages/core/test/render3/pipe_spec.ts index 4cf1f8e841..9e0a2a1312 100644 --- a/packages/core/test/render3/pipe_spec.ts +++ b/packages/core/test/render3/pipe_spec.ts @@ -107,7 +107,7 @@ describe('pipe', () => { transform() { return this.sayHelloService.getHello(); } - static ɵfac = (t?: any) => ɵɵgetInheritedFactory(t || SayHelloPipe)(SayHelloPipe); + static override ɵfac = (t?: any) => ɵɵgetInheritedFactory(t || SayHelloPipe)(SayHelloPipe); static ɵpipe = ɵɵdefinePipe({name: 'sayHello', type: SayHelloPipe, pure: true}); } diff --git a/packages/core/test/render3/providers_spec.ts b/packages/core/test/render3/providers_spec.ts index 82d505b664..921e2c5b82 100644 --- a/packages/core/test/render3/providers_spec.ts +++ b/packages/core/test/render3/providers_spec.ts @@ -1293,11 +1293,11 @@ describe('providers', () => { @addFoo() class Parent extends GrandParent { - static ɵfac = function Parent_Factory() {}; + static override ɵfac = function Parent_Factory() {}; } class Child extends Parent { - static ɵfac = function Child_Factory() {}; + static override ɵfac = function Child_Factory() {}; } expect(ɵɵgetInheritedFactory(Child).name).toBe('Parent_Factory'); @@ -1311,12 +1311,12 @@ describe('providers', () => { } class Parent extends GrandParent { - static ɵfac = function Parent_Factory() {}; + static override ɵfac = function Parent_Factory() {}; } @addFoo() class Child extends Parent { - static ɵfac = function Child_Factory() {}; + static override ɵfac = function Child_Factory() {}; } expect(ɵɵgetInheritedFactory(Child).name).toBe('Parent_Factory'); @@ -1331,11 +1331,11 @@ describe('providers', () => { } class Parent extends GrandParent { - static ɵfac = function Parent_Factory() {}; + static override ɵfac = function Parent_Factory() {}; } class Child extends Parent { - static ɵfac = function Child_Factory() {}; + static override ɵfac = function Child_Factory() {}; } expect(ɵɵgetInheritedFactory(Child).name).toBe('Parent_Factory'); @@ -1351,12 +1351,12 @@ describe('providers', () => { @addFoo() class Parent extends GrandParent { - static ɵfac = function Parent_Factory() {}; + static override ɵfac = function Parent_Factory() {}; } @addFoo() class Child extends Parent { - static ɵfac = function Child_Factory() {}; + static override ɵfac = function Child_Factory() {}; } expect(ɵɵgetInheritedFactory(Child).name).toBe('Parent_Factory'); @@ -1373,11 +1373,11 @@ describe('providers', () => { @addFoo() class Parent extends GrandParent { - static ɵfac = function Parent_Factory() {}; + static override ɵfac = function Parent_Factory() {}; } class Child extends Parent { - static ɵfac = function Child_Factory() {}; + static override ɵfac = function Child_Factory() {}; } expect(ɵɵgetInheritedFactory(Child).name).toBe('Parent_Factory'); diff --git a/packages/core/test/testability/testability_spec.ts b/packages/core/test/testability/testability_spec.ts index 63dd0bffc8..907e64aa2e 100644 --- a/packages/core/test/testability/testability_spec.ts +++ b/packages/core/test/testability/testability_spec.ts @@ -26,10 +26,10 @@ function microTask(fn: Function): void { @Injectable() class MockNgZone extends NgZone { /** @internal */ - onUnstable: EventEmitter; + override onUnstable: EventEmitter; /** @internal */ - onStable: EventEmitter; + override onStable: EventEmitter; constructor() { super({enableLongStackTrace: false}); diff --git a/packages/core/testing/src/ng_zone_mock.ts b/packages/core/testing/src/ng_zone_mock.ts index e6aae4a7c0..d0f4aa3da0 100644 --- a/packages/core/testing/src/ng_zone_mock.ts +++ b/packages/core/testing/src/ng_zone_mock.ts @@ -14,17 +14,17 @@ import {EventEmitter, Injectable, NgZone} from '@angular/core'; */ @Injectable() export class MockNgZone extends NgZone { - onStable: EventEmitter = new EventEmitter(false); + override onStable: EventEmitter = new EventEmitter(false); constructor() { super({enableLongStackTrace: false, shouldCoalesceEventChangeDetection: false}); } - run(fn: Function): any { + override run(fn: Function): any { return fn(); } - runOutsideAngular(fn: Function): any { + override runOutsideAngular(fn: Function): any { return fn(); }