Skip to content

Commit

Permalink
perf(module:*): add tsconfig noImplicitOverride (NG-ZORRO#7149)
Browse files Browse the repository at this point in the history
* perf(module:*): add tsconfig noImplicit override

* fix: fix ts errors

* revert: revert cdk type

* fix: fix type error

Co-authored-by: simplejason <simplejason.coder@gmail.com>
  • Loading branch information
hamster and simplejason committed Jan 15, 2022
1 parent 87a3e27 commit 806f024
Show file tree
Hide file tree
Showing 34 changed files with 137 additions and 140 deletions.
1 change: 1 addition & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ stages:
inputs:
command: 'install'
- script: npm run test:schematics

dependsOn: env

- stage: lint
Expand Down
4 changes: 2 additions & 2 deletions components/carousel/strategies/experimental/flip-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { NzCarouselContentDirective } from '../../carousel-content.directive';
import { NzCarouselBaseStrategy } from '../base-strategy';

export class NzCarouselFlipStrategy extends NzCarouselBaseStrategy {
withCarouselContents(contents: QueryList<NzCarouselContentDirective> | null): void {
override withCarouselContents(contents: QueryList<NzCarouselContentDirective> | null): void {
super.withCarouselContents(contents);

if (this.contents) {
Expand Down Expand Up @@ -59,7 +59,7 @@ export class NzCarouselFlipStrategy extends NzCarouselBaseStrategy {
return complete$.asObservable();
}

dispose(): void {
override dispose(): void {
this.contents.forEach((content: NzCarouselContentDirective) => {
this.renderer.setStyle(content.el, 'transition', null);
this.renderer.setStyle(content.el, 'transform', null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ export class NzCarouselTransformNoLoopStrategy extends NzCarouselBaseStrategy<Nz
super(carouselComponent, cdr, renderer, platform, options);
}

dispose(): void {
override dispose(): void {
this.renderer.setStyle(this.slickTrackEl, 'transform', null);

super.dispose();
}

withCarouselContents(contents: QueryList<NzCarouselContentDirective> | null): void {
override withCarouselContents(contents: QueryList<NzCarouselContentDirective> | null): void {
super.withCarouselContents(contents);

const carousel = this.carouselComponent!;
Expand Down Expand Up @@ -106,7 +106,7 @@ export class NzCarouselTransformNoLoopStrategy extends NzCarouselBaseStrategy<Nz
return complete$.asObservable();
}

dragging(vector: PointerVector): void {
override dragging(vector: PointerVector): void {
if (this.isTransitioning) {
return;
}
Expand Down
4 changes: 2 additions & 2 deletions components/carousel/strategies/opacity-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { NzCarouselContentDirective } from '../carousel-content.directive';
import { NzCarouselBaseStrategy } from './base-strategy';

export class NzCarouselOpacityStrategy extends NzCarouselBaseStrategy {
withCarouselContents(contents: QueryList<NzCarouselContentDirective> | null): void {
override withCarouselContents(contents: QueryList<NzCarouselContentDirective> | null): void {
super.withCarouselContents(contents);

if (this.contents) {
Expand Down Expand Up @@ -42,7 +42,7 @@ export class NzCarouselOpacityStrategy extends NzCarouselBaseStrategy {
return complete$;
}

dispose(): void {
override dispose(): void {
this.contents.forEach((content: NzCarouselContentDirective) => {
this.renderer.setStyle(content.el, 'transition', null);
this.renderer.setStyle(content.el, 'opacity', null);
Expand Down
6 changes: 3 additions & 3 deletions components/carousel/strategies/transform-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ export class NzCarouselTransformStrategy extends NzCarouselBaseStrategy<NzCarous
super(carouselComponent, cdr, renderer, platform, options);
}

dispose(): void {
override dispose(): void {
super.dispose();
this.renderer.setStyle(this.slickTrackEl, 'transform', null);
}

withCarouselContents(contents: QueryList<NzCarouselContentDirective> | null): void {
override withCarouselContents(contents: QueryList<NzCarouselContentDirective> | null): void {
super.withCarouselContents(contents);

const carousel = this.carouselComponent!;
Expand Down Expand Up @@ -111,7 +111,7 @@ export class NzCarouselTransformStrategy extends NzCarouselBaseStrategy<NzCarous
return complete$.asObservable();
}

dragging(_vector: PointerVector): void {
override dragging(_vector: PointerVector): void {
if (this.isTransitioning) {
return;
}
Expand Down
4 changes: 2 additions & 2 deletions components/comment/comment-cells.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ export class NzCommentActionHostDirective extends CdkPortalOutlet implements OnI
super(componentFactoryResolver, viewContainerRef);
}

ngOnInit(): void {
override ngOnInit(): void {
super.ngOnInit();
}

ngOnDestroy(): void {
override ngOnDestroy(): void {
super.ngOnDestroy();
}

Expand Down
11 changes: 5 additions & 6 deletions components/core/testing/mock-ng-zone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

import { EventEmitter, Injectable, NgZone } from '@angular/core';

import { NzSafeAny } from 'ng-zorro-antd/core/types';

/**
* Mock synchronous NgZone implementation that can be used
* to flush out `onStable` subscriptions in tests.
Expand All @@ -15,20 +17,17 @@ import { EventEmitter, Injectable, NgZone } from '@angular/core';
*/
@Injectable()
export class MockNgZone extends NgZone {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
onStable: EventEmitter<any> = new EventEmitter(false);
override onStable: EventEmitter<NzSafeAny> = new EventEmitter(false);

constructor() {
super({ enableLongStackTrace: false });
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
run(fn: Function): any {
override run(fn: Function): NzSafeAny {
return fn();
}

// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any
runOutsideAngular(fn: Function): any {
override runOutsideAngular(fn: Function): NzSafeAny {
return fn();
}

Expand Down
4 changes: 2 additions & 2 deletions components/date-picker/lib/date-table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { transCompatFormat } from './util';
templateUrl: './abstract-table.html'
})
export class DateTableComponent extends AbstractTable implements OnChanges, OnInit {
@Input() locale!: NzCalendarI18nInterface;
@Input() override locale!: NzCalendarI18nInterface;

constructor(private i18n: NzI18nService, private dateHelper: DateHelperService) {
super();
Expand Down Expand Up @@ -146,7 +146,7 @@ export class DateTableComponent extends AbstractTable implements OnChanges, OnIn
cell.classMap = this.getClassMap(cell);
}

getClassMap(cell: DateCell): { [key: string]: boolean } {
override getClassMap(cell: DateCell): { [key: string]: boolean } {
const date = new CandyDate(cell.value);
return {
...super.getClassMap(cell),
Expand Down
8 changes: 4 additions & 4 deletions components/date-picker/lib/decade-header.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import { PanelSelector } from './interface';
templateUrl: './abstract-panel-header.html'
})
export class DecadeHeaderComponent extends AbstractPanelHeader {
previous(): void {}
next(): void {}
override previous(): void {}
override next(): void {}

get startYear(): number {
return parseInt(`${this.value.getYear() / 100}`, 10) * 100;
Expand All @@ -26,11 +26,11 @@ export class DecadeHeaderComponent extends AbstractPanelHeader {
return this.startYear + 99;
}

superPrevious(): void {
override superPrevious(): void {
this.changeValue(this.value.addYears(-100));
}

superNext(): void {
override superNext(): void {
this.changeValue(this.value.addYears(100));
}

Expand Down
2 changes: 1 addition & 1 deletion components/date-picker/lib/decade-table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class DecadeTableComponent extends AbstractTable implements OnChanges {
return decades;
}

getClassMap(cell: DecadeCell): { [key: string]: boolean } {
override getClassMap(cell: DecadeCell): { [key: string]: boolean } {
return {
[`${this.prefixCls}-cell`]: true,
[`${this.prefixCls}-cell-in-view`]: !cell.isBiggerThanEnd && !cell.isLowerThanStart,
Expand Down
4 changes: 2 additions & 2 deletions components/date-picker/lib/month-table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import { DateBodyRow, DateCell } from './interface';
templateUrl: 'abstract-table.html'
})
export class MonthTableComponent extends AbstractTable implements OnChanges, OnInit {
MAX_ROW = 4;
MAX_COL = 3;
override MAX_ROW = 4;
override MAX_COL = 3;

constructor(private dateHelper: DateHelperService) {
super();
Expand Down
4 changes: 2 additions & 2 deletions components/date-picker/lib/year-header.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ export class YearHeaderComponent extends AbstractPanelHeader {
return this.startYear + 9;
}

superPrevious(): void {
override superPrevious(): void {
this.changeValue(this.value.addYears(-10));
}

superNext(): void {
override superNext(): void {
this.changeValue(this.value.addYears(10));
}

Expand Down
6 changes: 3 additions & 3 deletions components/date-picker/lib/year-table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import { DateBodyRow, DateCell, YearCell } from './interface';
templateUrl: 'abstract-table.html'
})
export class YearTableComponent extends AbstractTable {
MAX_ROW = 4;
MAX_COL = 3;
override MAX_ROW = 4;
override MAX_COL = 3;

constructor(private dateHelper: DateHelperService) {
super();
Expand Down Expand Up @@ -74,7 +74,7 @@ export class YearTableComponent extends AbstractTable {
return years;
}

getClassMap(cell: YearCell): { [key: string]: boolean } {
override getClassMap(cell: YearCell): { [key: string]: boolean } {
return {
...super.getClassMap(cell),
[`ant-picker-cell-in-view`]: !!cell.isSameDecade
Expand Down
4 changes: 2 additions & 2 deletions components/form/demo/auto-tips.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export type MyErrorsOptions = { 'zh-cn': string; en: string } & Record<string, N
export type MyValidationErrors = Record<string, MyErrorsOptions>;

export class MyValidators extends Validators {
static minLength(minLength: number): ValidatorFn {
static override minLength(minLength: number): ValidatorFn {
return (control: AbstractControl): MyValidationErrors | null => {
if (Validators.minLength(minLength)(control) === null) {
return null;
Expand All @@ -142,7 +142,7 @@ export class MyValidators extends Validators {
};
}

static maxLength(maxLength: number): ValidatorFn {
static override maxLength(maxLength: number): ValidatorFn {
return (control: AbstractControl): MyValidationErrors | null => {
if (Validators.maxLength(maxLength)(control) === null) {
return null;
Expand Down
2 changes: 1 addition & 1 deletion components/form/form-control.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ export type MyErrorsOptions = { 'zh-cn': string; en: string } & Record<string, N
export type MyValidationErrors = Record<string, MyErrorsOptions>;

export class MyValidators extends Validators {
static minLength(minLength: number): ValidatorFn {
static override minLength(minLength: number): ValidatorFn {
return (control: AbstractControl): MyValidationErrors | null => {
if (Validators.minLength(minLength)(control) === null) {
return null;
Expand Down
2 changes: 1 addition & 1 deletion components/icon/icon.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class NzIconDirective extends IconDirective implements OnInit, OnChanges,
this.el = elementRef.nativeElement;
}

ngOnChanges(changes: SimpleChanges): void {
override ngOnChanges(changes: SimpleChanges): void {
const { nzType, nzTwotoneColor, nzSpin, nzTheme, nzRotate } = changes;

if (nzType || nzTwotoneColor || nzSpin || nzTheme) {
Expand Down
4 changes: 0 additions & 4 deletions components/message/message-container.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@

import { Direction } from '@angular/cdk/bidi';
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ViewEncapsulation } from '@angular/core';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';

import { MessageConfig, NzConfigService } from 'ng-zorro-antd/core/config';
import { toCssPixel } from 'ng-zorro-antd/core/util';

import { NzMNContainerComponent } from './base';
import { NzMessageData } from './typings';

const NZ_CONFIG_COMPONENT_NAME = 'message';

Expand Down Expand Up @@ -42,9 +40,7 @@ const NZ_MESSAGE_DEFAULT_CONFIG: Required<MessageConfig> = {
`
})
export class NzMessageContainerComponent extends NzMNContainerComponent {
readonly destroy$ = new Subject<void>();
dir: Direction = 'ltr';
instances: Array<Required<NzMessageData>> = [];
top?: string | null;

constructor(cdr: ChangeDetectorRef, nzConfigService: NzConfigService) {
Expand Down
4 changes: 2 additions & 2 deletions components/message/message.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ import { NzMessageData } from './typings';
`
})
export class NzMessageComponent extends NzMNComponent implements OnInit, OnDestroy {
@Input() instance!: Required<NzMessageData>;
@Output() readonly destroyed = new EventEmitter<{ id: string; userAction: boolean }>();
@Input() override instance!: Required<NzMessageData>;
@Output() override readonly destroyed = new EventEmitter<{ id: string; userAction: boolean }>();

constructor(cdr: ChangeDetectorRef) {
super(cdr);
Expand Down
2 changes: 1 addition & 1 deletion components/message/message.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { NzMessageData, NzMessageDataOptions, NzMessageRef } from './typings';
providedIn: NzMessageServiceModule
})
export class NzMessageService extends NzMNService {
protected container?: NzMessageContainerComponent;
protected override container?: NzMessageContainerComponent;
protected componentPrefix = 'message-';

constructor(nzSingletonService: NzSingletonService, overlay: Overlay, injector: Injector) {
Expand Down
10 changes: 5 additions & 5 deletions components/modal/modal-confirm-container.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ import { ModalOptions } from './modal-types';
}
})
export class NzModalConfirmContainerComponent extends BaseModalContainerComponent implements OnInit {
@ViewChild(CdkPortalOutlet, { static: true }) portalOutlet!: CdkPortalOutlet;
@ViewChild('modalElement', { static: true }) modalElementRef!: ElementRef<HTMLDivElement>;
@Output() readonly cancelTriggered = new EventEmitter<void>();
@Output() readonly okTriggered = new EventEmitter<void>();
@ViewChild(CdkPortalOutlet, { static: true }) override portalOutlet!: CdkPortalOutlet;
@ViewChild('modalElement', { static: true }) override modalElementRef!: ElementRef<HTMLDivElement>;
@Output() override readonly cancelTriggered = new EventEmitter<void>();
@Output() override readonly okTriggered = new EventEmitter<void>();
locale!: NzModalI18nInterface;

constructor(
Expand All @@ -122,7 +122,7 @@ export class NzModalConfirmContainerComponent extends BaseModalContainerComponen
render: Renderer2,
overlayRef: OverlayRef,
nzConfigService: NzConfigService,
public config: ModalOptions,
public override config: ModalOptions,
@Optional() @Inject(DOCUMENT) document: NzSafeAny,
@Optional() @Inject(ANIMATION_MODULE_TYPE) animationType: string
) {
Expand Down
7 changes: 3 additions & 4 deletions components/modal/modal-container.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,8 @@ import { ModalOptions } from './modal-types';
}
})
export class NzModalContainerComponent extends BaseModalContainerComponent implements OnInit {
@ViewChild(CdkPortalOutlet, { static: true }) portalOutlet!: CdkPortalOutlet;
@ViewChild('modalElement', { static: true }) modalElementRef!: ElementRef<HTMLDivElement>;

@ViewChild(CdkPortalOutlet, { static: true }) override portalOutlet!: CdkPortalOutlet;
@ViewChild('modalElement', { static: true }) override modalElementRef!: ElementRef<HTMLDivElement>;
constructor(
ngZone: NgZone,
host: ElementRef<HTMLElement>,
Expand All @@ -86,7 +85,7 @@ export class NzModalContainerComponent extends BaseModalContainerComponent imple
render: Renderer2,
overlayRef: OverlayRef,
nzConfigService: NzConfigService,
public config: ModalOptions,
public override config: ModalOptions,
@Optional() @Inject(DOCUMENT) document: NzSafeAny,
@Optional() @Inject(ANIMATION_MODULE_TYPE) animationType: string
) {
Expand Down

0 comments on commit 806f024

Please sign in to comment.