Skip to content

Commit 4b44c57

Browse files
devversionjelbourn
authored andcommitted
refactor: remove inherited coercion acceptance members (#17911)
Previously Angular did not inherit coercion acceptance members until we submitted an issue on the framework side. This issue will be fixed with angular/angular#34296. In preparation for that change to land, this PR removes all unnecessary acceptance members and updates the lint rule to avoid future duplications (the rule is also used to make that refactoring) (cherry picked from commit 7a6f763)
1 parent ca9b204 commit 4b44c57

File tree

42 files changed

+73
-201
lines changed

Some content is hidden

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

42 files changed

+73
-201
lines changed

src/components-examples/cdk/stepper/cdk-custom-stepper-without-form/cdk-custom-stepper-without-form-example.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,4 @@ export class CustomStepper extends CdkStepper {
2020
onClick(index: number): void {
2121
this.selectedIndex = index;
2222
}
23-
24-
// These properties are required so that the Ivy template type checker in strict mode knows
25-
// what kind of values are accepted by the `linear` and `selectedIndex` inputs which
26-
// are inherited from `CdkStepper`.
27-
static ngAcceptInputType_linear: boolean | string | null | undefined;
28-
static ngAcceptInputType_selectedIndex: number | string | null | undefined;
2923
}

src/material-experimental/mdc-button/button-base.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9+
import {BooleanInput} from '@angular/cdk/coercion';
910
import {Platform} from '@angular/cdk/platform';
1011
import {Directive, ElementRef, HostListener, NgZone, ViewChild} from '@angular/core';
1112
import {
@@ -124,6 +125,9 @@ export class MatButtonBase extends _MatButtonBaseMixin implements CanDisable, Ca
124125
_isRippleDisabled() {
125126
return this.disableRipple || this.disabled;
126127
}
128+
129+
static ngAcceptInputType_disabled: BooleanInput;
130+
static ngAcceptInputType_disableRipple: BooleanInput;
127131
}
128132

129133
/** Shared inputs by buttons using the `<a>` tag */

src/material-experimental/mdc-button/button.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {BooleanInput} from '@angular/cdk/coercion';
109
import {Platform} from '@angular/cdk/platform';
1110
import {
1211
ChangeDetectionStrategy,
@@ -56,9 +55,6 @@ export class MatButton extends MatButtonBase {
5655
@Optional() @Inject(ANIMATION_MODULE_TYPE) animationMode?: string) {
5756
super(elementRef, platform, ngZone, animationMode);
5857
}
59-
60-
static ngAcceptInputType_disabled: BooleanInput;
61-
static ngAcceptInputType_disableRipple: BooleanInput;
6258
}
6359

6460
/**
@@ -87,7 +83,4 @@ export class MatAnchor extends MatAnchorBase {
8783
@Optional() @Inject(ANIMATION_MODULE_TYPE) animationMode?: string) {
8884
super(elementRef, platform, ngZone, animationMode);
8985
}
90-
91-
static ngAcceptInputType_disabled: BooleanInput;
92-
static ngAcceptInputType_disableRipple: BooleanInput;
9386
}

src/material-experimental/mdc-button/fab.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {BooleanInput} from '@angular/cdk/coercion';
109
import {Platform} from '@angular/cdk/platform';
1110
import {
1211
ChangeDetectionStrategy,
@@ -55,9 +54,6 @@ export class MatFabButton extends MatButtonBase {
5554
@Optional() @Inject(ANIMATION_MODULE_TYPE) animationMode?: string) {
5655
super(elementRef, platform, ngZone, animationMode);
5756
}
58-
59-
static ngAcceptInputType_disabled: BooleanInput;
60-
static ngAcceptInputType_disableRipple: BooleanInput;
6157
}
6258

6359

@@ -87,7 +83,4 @@ export class MatFabAnchor extends MatAnchor {
8783
@Optional() @Inject(ANIMATION_MODULE_TYPE) animationMode?: string) {
8884
super(elementRef, platform, ngZone, animationMode);
8985
}
90-
91-
static ngAcceptInputType_disabled: BooleanInput;
92-
static ngAcceptInputType_disableRipple: BooleanInput;
9386
}

src/material-experimental/mdc-button/icon-button.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {BooleanInput} from '@angular/cdk/coercion';
109
import {Platform} from '@angular/cdk/platform';
1110
import {
1211
ChangeDetectionStrategy,
@@ -52,9 +51,6 @@ export class MatIconButton extends MatButtonBase {
5251
@Optional() @Inject(ANIMATION_MODULE_TYPE) animationMode?: string) {
5352
super(elementRef, platform, ngZone, animationMode);
5453
}
55-
56-
static ngAcceptInputType_disabled: BooleanInput;
57-
static ngAcceptInputType_disableRipple: BooleanInput;
5854
}
5955

6056
/**
@@ -81,7 +77,4 @@ export class MatIconAnchor extends MatAnchorBase {
8177
@Optional() @Inject(ANIMATION_MODULE_TYPE) animationMode?: string) {
8278
super(elementRef, platform, ngZone, animationMode);
8379
}
84-
85-
static ngAcceptInputType_disabled: BooleanInput;
86-
static ngAcceptInputType_disableRipple: BooleanInput;
8780
}

src/material-experimental/mdc-chips/chip-listbox.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,5 @@ export class MatChipListbox extends MatChipSet implements AfterContentInit, Cont
557557
static ngAcceptInputType_multiple: BooleanInput;
558558
static ngAcceptInputType_selectable: BooleanInput;
559559
static ngAcceptInputType_required: BooleanInput;
560-
static ngAcceptInputType_disabled: BooleanInput;
561560
}
562561

src/material-experimental/mdc-chips/chip-option.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,4 @@ export class MatChipOption extends MatChip {
227227

228228
static ngAcceptInputType_selectable: BooleanInput;
229229
static ngAcceptInputType_selected: BooleanInput;
230-
static ngAcceptInputType_disabled: BooleanInput;
231-
static ngAcceptInputType_removable: BooleanInput;
232-
static ngAcceptInputType_highlighted: BooleanInput;
233-
static ngAcceptInputType_disableRipple: BooleanInput;
234230
}

src/material-experimental/mdc-chips/chip-row.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {BooleanInput} from '@angular/cdk/coercion';
109
import {BACKSPACE, DELETE} from '@angular/cdk/keycodes';
1110
import {
1211
AfterContentInit,
@@ -149,9 +148,4 @@ export class MatChipRow extends MatChip implements AfterContentInit, AfterViewIn
149148
this._handleInteraction(event);
150149
}
151150
}
152-
153-
static ngAcceptInputType_disabled: BooleanInput;
154-
static ngAcceptInputType_removable: BooleanInput;
155-
static ngAcceptInputType_highlighted: BooleanInput;
156-
static ngAcceptInputType_disableRipple: BooleanInput;
157151
}

src/material-experimental/mdc-input/input.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,5 @@ import {MatInput as BaseMatInput} from '@angular/material/input';
3838
},
3939
providers: [{provide: MatFormFieldControl, useExisting: MatInput}],
4040
})
41-
export class MatInput extends BaseMatInput {
42-
static ngAcceptInputType_disabled: boolean | string | null | undefined;
43-
static ngAcceptInputType_readonly: boolean | string | null | undefined;
44-
static ngAcceptInputType_required: boolean | string | null | undefined;
45-
static ngAcceptInputType_value: any;
46-
}
41+
export class MatInput extends BaseMatInput {}
4742

src/material-experimental/mdc-menu/menu-item.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {BooleanInput} from '@angular/cdk/coercion';
109
import {Component, ChangeDetectionStrategy, ViewEncapsulation} from '@angular/core';
1110
import {MatMenuItem as BaseMatMenuItem} from '@angular/material/menu';
1211

@@ -38,6 +37,4 @@ import {MatMenuItem as BaseMatMenuItem} from '@angular/material/menu';
3837
]
3938
})
4039
export class MatMenuItem extends BaseMatMenuItem {
41-
static ngAcceptInputType_disabled: BooleanInput;
42-
static ngAcceptInputType_disableRipple: BooleanInput;
4340
}

src/material-experimental/mdc-menu/menu.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {BooleanInput} from '@angular/cdk/coercion';
109
import {Overlay, ScrollStrategy} from '@angular/cdk/overlay';
1110
import {
1211
ChangeDetectionStrategy,
@@ -71,7 +70,4 @@ export class MatMenu extends BaseMatMenu {
7170
// - should update the elevation when the same menu is opened at a different depth
7271
// - should not increase the elevation if the user specified a custom one
7372
}
74-
75-
static ngAcceptInputType_overlapTrigger: BooleanInput;
76-
static ngAcceptInputType_hasBackdrop: BooleanInput;
7773
}

src/material-experimental/mdc-table/cell.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ export class MatColumnDef extends CdkColumnDef {
6363
@Input('matColumnDef') name: string;
6464

6565
static ngAcceptInputType_sticky: BooleanInput;
66-
static ngAcceptInputType_stickyEnd: BooleanInput;
6766
}
6867

6968
/** Header cell template container that adds the right classes and role. */

src/material-experimental/mdc-table/table.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
import {ChangeDetectionStrategy, Component, OnInit, ViewEncapsulation} from '@angular/core';
1010
import {CDK_TABLE_TEMPLATE, CdkTable} from '@angular/cdk/table';
11-
import {BooleanInput} from '@angular/cdk/coercion';
1211

1312
@Component({
1413
selector: 'table[mat-table]',
@@ -28,8 +27,6 @@ export class MatTable<T> extends CdkTable<T> implements OnInit {
2827
/** Overrides the sticky CSS class set by the `CdkTable`. */
2928
protected stickyCssClass = 'mat-mdc-table-sticky';
3029

31-
static ngAcceptInputType_multiTemplateDataRows: BooleanInput;
32-
3330
// After ngOnInit, the `CdkTable` has created and inserted the table sections (thead, tbody,
3431
// tfoot). MDC requires the `mdc-data-table__content` class to be added to the body.
3532
ngOnInit() {

src/material-experimental/mdc-tabs/tab-group.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,5 @@ export class MatTabGroup extends _MatTabGroupBase {
7777
}
7878

7979
static ngAcceptInputType_fitInkBarToContent: BooleanInput;
80-
static ngAcceptInputType_dynamicHeight: BooleanInput;
8180
static ngAcceptInputType_animationDuration: NumberInput;
82-
static ngAcceptInputType_selectedIndex: NumberInput;
83-
static ngAcceptInputType_disableRipple: BooleanInput;
8481
}

src/material-experimental/mdc-tabs/tab-header.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {BooleanInput, NumberInput} from '@angular/cdk/coercion';
9+
import {BooleanInput} from '@angular/cdk/coercion';
1010
import {
1111
ChangeDetectionStrategy,
1212
Component,
@@ -75,5 +75,4 @@ export class MatTabHeader extends _MatTabHeaderBase implements AfterContentInit
7575
}
7676

7777
static ngAcceptInputType_disableRipple: BooleanInput;
78-
static ngAcceptInputType_selectedIndex: NumberInput;
7978
}

src/material-experimental/mdc-tabs/tab-label-wrapper.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,4 @@ export class MatTabLabelWrapper extends BaseMatTabLabelWrapper
5555
}
5656

5757
static ngAcceptInputType_fitInkBarToContent: BooleanInput;
58-
static ngAcceptInputType_disabled: BooleanInput;
5958
}

src/material-experimental/mdc-tabs/tab-nav-bar/tab-nav-bar.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import {Directionality} from '@angular/cdk/bidi';
3636
import {ViewportRuler} from '@angular/cdk/scrolling';
3737
import {Platform} from '@angular/cdk/platform';
3838
import {MatInkBar, MatInkBarItem, MatInkBarFoundation} from '../ink-bar';
39-
import {BooleanInput, coerceBooleanProperty, NumberInput} from '@angular/cdk/coercion';
39+
import {BooleanInput, coerceBooleanProperty} from '@angular/cdk/coercion';
4040
import {BehaviorSubject, Subject} from 'rxjs';
4141
import {takeUntil} from 'rxjs/operators';
4242

@@ -104,7 +104,6 @@ export class MatTabNav extends _MatTabNavBase implements AfterContentInit {
104104

105105
static ngAcceptInputType_fitInkBarToContent: BooleanInput;
106106
static ngAcceptInputType_disableRipple: BooleanInput;
107-
static ngAcceptInputType_selectedIndex: NumberInput;
108107
}
109108

110109
/**
@@ -156,7 +155,4 @@ export class MatTabLink extends _MatTabLinkBase implements MatInkBarItem, OnInit
156155
super.ngOnDestroy();
157156
this._foundation.destroy();
158157
}
159-
160-
static ngAcceptInputType_disabled: BooleanInput;
161-
static ngAcceptInputType_disableRipple: BooleanInput;
162158
}

src/material-experimental/mdc-tabs/tab.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {BooleanInput} from '@angular/cdk/coercion';
109
import {
1110
ChangeDetectionStrategy,
1211
Component,
@@ -39,6 +38,4 @@ export class MatTab extends BaseMatTab {
3938

4039
/** Content for the tab label given by `<ng-template mat-tab-label>`. */
4140
@ContentChild(MatTabLabel) templateLabel: MatTabLabel;
42-
43-
static ngAcceptInputType_disabled: BooleanInput;
4441
}

src/material/button/button.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,4 @@ export class MatAnchor extends MatButton {
181181
event.stopImmediatePropagation();
182182
}
183183
}
184-
185-
static ngAcceptInputType_disabled: BooleanInput;
186-
static ngAcceptInputType_disableRipple: BooleanInput;
187184
}

src/material/expansion/accordion.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,4 @@ export class MatAccordion extends CdkAccordion implements MatAccordionBase, Afte
103103
}
104104

105105
static ngAcceptInputType_hideToggle: BooleanInput;
106-
static ngAcceptInputType_multi: BooleanInput;
107106
}

src/material/input/autosize.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {BooleanInput, NumberInput} from '@angular/cdk/coercion';
109
import {CdkTextareaAutosize} from '@angular/cdk/text-field';
1110
import {Directive, Input} from '@angular/core';
1211

@@ -42,8 +41,4 @@ export class MatTextareaAutosize extends CdkTextareaAutosize {
4241
@Input()
4342
get matTextareaAutosize(): boolean { return this.enabled; }
4443
set matTextareaAutosize(value: boolean) { this.enabled = value; }
45-
46-
static ngAcceptInputType_minRows: NumberInput;
47-
static ngAcceptInputType_maxRows: NumberInput;
48-
static ngAcceptInputType_enabled: BooleanInput;
4944
}

src/material/menu/menu.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,9 @@ export class _MatMenuBase implements AfterContentInit, MatMenuPanel<MatMenuItem>
475475
this._directDescendantItems.notifyOnChanges();
476476
});
477477
}
478+
479+
static ngAcceptInputType_overlapTrigger: BooleanInput;
480+
static ngAcceptInputType_hasBackdrop: BooleanInput;
478481
}
479482

480483
/** @docs-private We show the "_MatMenu" class as "MatMenu" in the docs. */
@@ -516,7 +519,4 @@ export class _MatMenu extends MatMenu {
516519
@Inject(MAT_MENU_DEFAULT_OPTIONS) defaultOptions: MatMenuDefaultOptions) {
517520
super(elementRef, ngZone, defaultOptions);
518521
}
519-
520-
static ngAcceptInputType_overlapTrigger: BooleanInput;
521-
static ngAcceptInputType_hasBackdrop: BooleanInput;
522522
}

src/material/progress-spinner/progress-spinner.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,10 +332,6 @@ export class MatSpinner extends MatProgressSpinner {
332332
super(elementRef, platform, document, animationMode, defaults);
333333
this.mode = 'indeterminate';
334334
}
335-
336-
static ngAcceptInputType_diameter: NumberInput;
337-
static ngAcceptInputType_strokeWidth: NumberInput;
338-
static ngAcceptInputType_value: NumberInput;
339335
}
340336

341337

src/material/sidenav/sidenav.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,6 @@ export class MatSidenav extends MatDrawer {
104104
static ngAcceptInputType_fixedInViewport: BooleanInput;
105105
static ngAcceptInputType_fixedTopGap: NumberInput;
106106
static ngAcceptInputType_fixedBottomGap: NumberInput;
107-
static ngAcceptInputType_disableClose: BooleanInput;
108-
static ngAcceptInputType_autoFocus: BooleanInput;
109-
static ngAcceptInputType_opened: BooleanInput;
110107
}
111108

112109

@@ -136,7 +133,5 @@ export class MatSidenavContainer extends MatDrawerContainer {
136133
_allDrawers: QueryList<MatSidenav>;
137134

138135
@ContentChild(MatSidenavContent) _content: MatSidenavContent;
139-
140-
static ngAcceptInputType_autosize: BooleanInput;
141136
static ngAcceptInputType_hasBackdrop: BooleanInput;
142137
}

0 commit comments

Comments
 (0)