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
}

0 commit comments

Comments
 (0)