Skip to content

Commit dc8f98e

Browse files
authored
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.
1 parent 29e67e6 commit dc8f98e

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
@@ -155,12 +155,12 @@ export const MAT_SELECT_SCROLL_STRATEGY_PROVIDER = {
155155
export const MAT_SELECT_TRIGGER = new InjectionToken<MatSelectTrigger>('MatSelectTrigger');
156156

157157
/** Change event object that is emitted when the select value has changed. */
158-
export class MatSelectChange {
158+
export class MatSelectChange<T = any> {
159159
constructor(
160160
/** Reference to the select that emitted the change event. */
161161
public source: MatSelect,
162162
/** Current value of the select that emitted the event. */
163-
public value: any,
163+
public value: T,
164164
) {}
165165
}
166166

tools/public_api_guard/material/select.md

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

225225
// @public
226-
export class MatSelectChange {
226+
export class MatSelectChange<T = any> {
227227
constructor(
228228
source: MatSelect,
229-
value: any);
229+
value: T);
230230
source: MatSelect;
231-
value: any;
231+
value: T;
232232
}
233233

234234
// @public

0 commit comments

Comments
 (0)