Skip to content

Commit 4a661cd

Browse files
Wiltmmalerba
authored andcommitted
fix(material/select): Optional typing of MatSelectChange (#30324)
This event should be typed. Added type and fallback to any to make this optional and backwards compatible. (cherry picked from commit dc8f98e)
1 parent 312231b commit 4a661cd

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/material/select/select.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,12 @@ export const MAT_SELECT_SCROLL_STRATEGY_PROVIDER = {
161161
export const MAT_SELECT_TRIGGER = new InjectionToken<MatSelectTrigger>('MatSelectTrigger');
162162

163163
/** Change event object that is emitted when the select value has changed. */
164-
export class MatSelectChange {
164+
export class MatSelectChange<T = any> {
165165
constructor(
166166
/** Reference to the select that emitted the change event. */
167167
public source: MatSelect,
168168
/** Current value of the select that emitted the event. */
169-
public value: any,
169+
public value: T,
170170
) {}
171171
}
172172

tools/public_api_guard/material/select.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ export class MatSelect implements AfterContentInit, OnChanges, OnDestroy, OnInit
189189
_scrollOptionIntoView(index: number): void;
190190
_scrollStrategy: ScrollStrategy;
191191
get selected(): MatOption | MatOption[];
192-
readonly selectionChange: EventEmitter<MatSelectChange>;
192+
readonly selectionChange: EventEmitter<MatSelectChange<any>>;
193193
_selectionModel: SelectionModel<MatOption>;
194194
setDescribedByIds(ids: string[]): void;
195195
setDisabledState(isDisabled: boolean): void;
@@ -224,12 +224,12 @@ export const matSelectAnimations: {
224224
};
225225

226226
// @public
227-
export class MatSelectChange {
227+
export class MatSelectChange<T = any> {
228228
constructor(
229229
source: MatSelect,
230-
value: any);
230+
value: T);
231231
source: MatSelect;
232-
value: any;
232+
value: T;
233233
}
234234

235235
// @public

0 commit comments

Comments
 (0)