Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit 271ca16

Browse files
refactor: Add declare to class fields in child class that overrides a base class field without explicitly reinitializing the field.
PiperOrigin-RevId: 679013309
1 parent f5b61a9 commit 271ca16

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

packages/mdc-switch/foundation.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ import {CssClasses} from './constants';
3333
* State observers and event handler entrypoints update a component's adapter's
3434
* state with the logic needed for switch to function.
3535
*/
36-
export class MDCSwitchFoundation extends
37-
MDCObserverFoundation<MDCSwitchAdapter> {
36+
export class MDCSwitchFoundation extends MDCObserverFoundation<MDCSwitchAdapter> {
3837
constructor(adapter: MDCSwitchAdapter) {
3938
super(adapter);
4039
this.handleClick = this.handleClick.bind(this);
@@ -79,7 +78,7 @@ export class MDCSwitchFoundation extends
7978
* render adapter to keep the component's DOM updated with the state.
8079
*/
8180
export class MDCSwitchRenderFoundation extends MDCSwitchFoundation {
82-
protected override adapter!: MDCSwitchRenderAdapter;
81+
protected declare adapter: MDCSwitchRenderAdapter;
8382

8483
/**
8584
* Initializes the foundation and starts observing state changes.
@@ -90,7 +89,7 @@ export class MDCSwitchRenderFoundation extends MDCSwitchFoundation {
9089
disabled: this.onDisabledChange,
9190
processing: this.onProcessingChange,
9291
selected: this.onSelectedChange,
93-
})
92+
});
9493
}
9594

9695
/**
@@ -107,8 +106,9 @@ export class MDCSwitchRenderFoundation extends MDCSwitchFoundation {
107106
// Ensure aria-checked is set if attribute is not present
108107
this.onSelectedChange();
109108
this.adapter.state.disabled = this.adapter.isDisabled();
110-
this.adapter.state.processing =
111-
this.adapter.hasClass(CssClasses.PROCESSING);
109+
this.adapter.state.processing = this.adapter.hasClass(
110+
CssClasses.PROCESSING,
111+
);
112112

113113
// Re-observe state
114114
this.setObserversEnabled(this.adapter.state, true);

0 commit comments

Comments
 (0)