Skip to content

Commit 69d1ee7

Browse files
devversionamysorto
authored andcommitted
refactor(multiple): enable noImplicitOverride typescript option (#22830)
* refactor(multiple): enable `noImplicitOverride` typescript option Enables the TypeScript `noImplicitOverride` option and adds the `override` keyword where needed. * build: add yarn script alias for tsc Adds a `yarn run` alias for the `tsc` binary. Since we have multiple versions of TypeScript installed, Yarn can pick another version (e.g. from `typescript-4.2`) for linking the `tsc` binary. This is unexpected because `yarn tsc` should resolve to the TypeScript version that is not installed through a Yarn alias. Changing the order in the Yarn lock file does not help, and it seems expected in the context of Yarn which does not know which package (regardless of alias or not) to prefer.
1 parent 8a98236 commit 69d1ee7

File tree

149 files changed

+350
-410
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+350
-410
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"check-mdc-tests": "ts-node --project scripts/tsconfig.json scripts/check-mdc-tests.ts",
5151
"check-mdc-exports": "ts-node --project scripts/tsconfig.json scripts/check-mdc-exports.ts",
5252
"check-tools": "yarn tsc --project tools/tsconfig-ci.json",
53+
"tsc": "node ./node_modules/typescript/bin/tsc",
5354
"prepare": "husky install"
5455
},
5556
"version": "12.1.0",

src/bazel-tsconfig-build.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"strictNullChecks": true,
1515
"noImplicitReturns": true,
1616
"strictFunctionTypes": true,
17+
"noImplicitOverride": true,
1718
"noFallthroughCasesInSwitch": true,
1819
"noImplicitAny": true,
1920
"noImplicitThis": true,

src/cdk-experimental/dialog/dialog-container.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ export class CdkDialogContainer extends BasePortalOutlet implements OnDestroy {
196196
* @deprecated To be turned into a method.
197197
* @breaking-change 10.0.0
198198
*/
199-
attachDomPortal = (portal: DomPortal) => {
199+
override attachDomPortal = (portal: DomPortal) => {
200200
if (this._portalHost.hasAttached() && (typeof ngDevMode === 'undefined' || ngDevMode)) {
201201
throwDialogContentAlreadyAttachedError();
202202
}

src/cdk-experimental/menu/menu-bar.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export class CdkMenuBar extends CdkMenuGroup implements Menu, AfterContentInit,
8686
super();
8787
}
8888

89-
ngAfterContentInit() {
89+
override ngAfterContentInit() {
9090
super.ngAfterContentInit();
9191

9292
this._setKeyManager();
@@ -287,7 +287,7 @@ export class CdkMenuBar extends CdkMenuGroup implements Menu, AfterContentInit,
287287
return !!this._openItem;
288288
}
289289

290-
ngOnDestroy() {
290+
override ngOnDestroy() {
291291
super.ngOnDestroy();
292292

293293
this._destroyed.next();

src/cdk-experimental/menu/menu-item-checkbox.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import {CdkMenuItem} from './menu-item';
3131
})
3232
export class CdkMenuItemCheckbox extends CdkMenuItemSelectable {
3333
/** Toggle the checked state of the checkbox. */
34-
trigger() {
34+
override trigger() {
3535
super.trigger();
3636

3737
if (!this.disabled) {

src/cdk-experimental/menu/menu-item-radio.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ export class CdkMenuItemRadio extends CdkMenuItemSelectable implements OnDestroy
6363
}
6464

6565
/** Toggles the checked state of the radio-button. */
66-
trigger() {
66+
override trigger() {
6767
super.trigger();
6868

6969
if (!this.disabled) {
7070
this._selectionDispatcher.notify(this.id, this.name);
7171
}
7272
}
7373

74-
ngOnDestroy() {
74+
override ngOnDestroy() {
7575
super.ngOnDestroy();
7676
this._removeDispatcherListener();
7777
}

src/cdk-experimental/menu/menu-item-selectable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export abstract class CdkMenuItemSelectable extends CdkMenuItem {
4040
@Input() id: string = `cdk-selectable-item-${nextId++}`;
4141

4242
/** If the element is not disabled emit the click event */
43-
trigger() {
43+
override trigger() {
4444
if (!this.disabled) {
4545
this.toggled.next(this);
4646
}

src/cdk-experimental/menu/menu-stack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,5 +130,5 @@ export class MenuStack {
130130
/** NoopMenuStack is a placeholder MenuStack used for inline menus. */
131131
export class NoopMenuStack extends MenuStack {
132132
/** Noop push - does not add elements to the MenuStack. */
133-
push(_: MenuStackItem) {}
133+
override push(_: MenuStackItem) {}
134134
}

src/cdk-experimental/menu/menu.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export class CdkMenu extends CdkMenuGroup implements Menu, AfterContentInit, OnI
124124
this._registerWithParentPanel();
125125
}
126126

127-
ngAfterContentInit() {
127+
override ngAfterContentInit() {
128128
super.ngAfterContentInit();
129129

130130
this._completeChangeEmitter();
@@ -348,7 +348,7 @@ export class CdkMenu extends CdkMenuGroup implements Menu, AfterContentInit, OnI
348348
return this._menuStack instanceof NoopMenuStack;
349349
}
350350

351-
ngOnDestroy() {
351+
override ngOnDestroy() {
352352
this._emitClosedEvent();
353353
this._pointerTracker?.destroy();
354354
}

src/cdk-experimental/popover-edit/table-directives.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,15 +362,15 @@ export class CdkPopoverEdit<C> implements AfterViewInit, OnDestroy {
362362
inputs: POPOVER_EDIT_INPUTS,
363363
})
364364
export class CdkPopoverEditTabOut<C> extends CdkPopoverEdit<C> {
365-
protected focusTrap?: FocusEscapeNotifier;
365+
protected override focusTrap?: FocusEscapeNotifier;
366366

367367
constructor(
368368
elementRef: ElementRef, viewContainerRef: ViewContainerRef, services: EditServices,
369369
protected readonly focusEscapeNotifierFactory: FocusEscapeNotifierFactory) {
370370
super(services, elementRef, viewContainerRef);
371371
}
372372

373-
protected initFocusTrap(): void {
373+
protected override initFocusTrap(): void {
374374
this.focusTrap = this.focusEscapeNotifierFactory.create(this.overlayRef!.overlayElement);
375375

376376
this.focusTrap.escapes().pipe(takeUntil(this.destroyed)).subscribe(direction => {

0 commit comments

Comments
 (0)