diff --git a/src/material-experimental/mdc-core/option/option.ts b/src/material-experimental/mdc-core/option/option.ts index 3785cad24c8a..0bb41033b108 100644 --- a/src/material-experimental/mdc-core/option/option.ts +++ b/src/material-experimental/mdc-core/option/option.ts @@ -48,7 +48,7 @@ import {MatOptgroup} from './optgroup'; encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, }) -export class MatOption extends _MatOptionBase { +export class MatOption extends _MatOptionBase { constructor( element: ElementRef, changeDetectorRef: ChangeDetectorRef, diff --git a/src/material/core/option/option.ts b/src/material/core/option/option.ts index bdc22e31ba9e..6a353560b19b 100644 --- a/src/material/core/option/option.ts +++ b/src/material/core/option/option.ts @@ -36,16 +36,16 @@ import {MatOptionParentComponent, MAT_OPTION_PARENT_COMPONENT} from './option-pa let _uniqueIdCounter = 0; /** Event object emitted by MatOption when selected or deselected. */ -export class MatOptionSelectionChange { +export class MatOptionSelectionChange { constructor( /** Reference to the option that emitted the event. */ - public source: _MatOptionBase, + public source: _MatOptionBase, /** Whether the change in the option's value was a result of a user action. */ public isUserInput = false) { } } @Directive() -export class _MatOptionBase implements FocusableOption, AfterViewChecked, OnDestroy { +export class _MatOptionBase implements FocusableOption, AfterViewChecked, OnDestroy { private _selected = false; private _active = false; private _disabled = false; @@ -58,7 +58,7 @@ export class _MatOptionBase implements FocusableOption, AfterViewChecked, OnDest get selected(): boolean { return this._selected; } /** The form value of the option. */ - @Input() value: any; + @Input() value: T; /** The unique ID of the option. */ @Input() id: string = `mat-option-${_uniqueIdCounter++}`; @@ -73,7 +73,7 @@ export class _MatOptionBase implements FocusableOption, AfterViewChecked, OnDest /** Event emitted when the option is selected or deselected. */ // tslint:disable-next-line:no-output-on-prefix - @Output() readonly onSelectionChange = new EventEmitter(); + @Output() readonly onSelectionChange = new EventEmitter>(); /** Emits when the state of the option changes and any parents have to be notified. */ readonly _stateChanges = new Subject(); @@ -225,7 +225,7 @@ export class _MatOptionBase implements FocusableOption, AfterViewChecked, OnDest /** Emits the selection change event. */ private _emitSelectionChangeEvent(isUserInput = false): void { - this.onSelectionChange.emit(new MatOptionSelectionChange(this, isUserInput)); + this.onSelectionChange.emit(new MatOptionSelectionChange(this, isUserInput)); } static ngAcceptInputType_disabled: BooleanInput; @@ -256,7 +256,7 @@ export class _MatOptionBase implements FocusableOption, AfterViewChecked, OnDest encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, }) -export class MatOption extends _MatOptionBase { +export class MatOption extends _MatOptionBase { constructor( element: ElementRef, changeDetectorRef: ChangeDetectorRef, diff --git a/tools/public_api_guard/material/core.md b/tools/public_api_guard/material/core.md index 1c71c84fbab8..458bd0f9ab90 100644 --- a/tools/public_api_guard/material/core.md +++ b/tools/public_api_guard/material/core.md @@ -281,16 +281,16 @@ export class _MatOptgroupBase extends _MatOptgroupMixinBase implements CanDisabl } // @public -export class MatOption extends _MatOptionBase { +export class MatOption extends _MatOptionBase { constructor(element: ElementRef, changeDetectorRef: ChangeDetectorRef, parent: MatOptionParentComponent, group: MatOptgroup); // (undocumented) - static ɵcmp: i0.ɵɵComponentDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration, "mat-option", ["matOption"], {}, {}, never, ["*"]>; // (undocumented) - static ɵfac: i0.ɵɵFactoryDeclaration; + static ɵfac: i0.ɵɵFactoryDeclaration, [null, null, { optional: true; }, { optional: true; }]>; } // @public (undocumented) -export class _MatOptionBase implements FocusableOption, AfterViewChecked, OnDestroy { +export class _MatOptionBase implements FocusableOption, AfterViewChecked, OnDestroy { constructor(_element: ElementRef, _changeDetectorRef: ChangeDetectorRef, _parent: MatOptionParentComponent, group: _MatOptgroupBase); get active(): boolean; deselect(): void; @@ -313,19 +313,19 @@ export class _MatOptionBase implements FocusableOption, AfterViewChecked, OnDest ngAfterViewChecked(): void; // (undocumented) ngOnDestroy(): void; - readonly onSelectionChange: EventEmitter; + readonly onSelectionChange: EventEmitter>; select(): void; get selected(): boolean; _selectViaInteraction(): void; setActiveStyles(): void; setInactiveStyles(): void; readonly _stateChanges: Subject; - value: any; + value: T; get viewValue(): string; // (undocumented) - static ɵdir: i0.ɵɵDirectiveDeclaration<_MatOptionBase, never, never, { "value": "value"; "id": "id"; "disabled": "disabled"; }, { "onSelectionChange": "onSelectionChange"; }, never>; + static ɵdir: i0.ɵɵDirectiveDeclaration<_MatOptionBase, never, never, { "value": "value"; "id": "id"; "disabled": "disabled"; }, { "onSelectionChange": "onSelectionChange"; }, never>; // (undocumented) - static ɵfac: i0.ɵɵFactoryDeclaration<_MatOptionBase, never>; + static ɵfac: i0.ɵɵFactoryDeclaration<_MatOptionBase, never>; } // @public (undocumented) @@ -349,12 +349,12 @@ export interface MatOptionParentComponent { } // @public -export class MatOptionSelectionChange { +export class MatOptionSelectionChange { constructor( - source: _MatOptionBase, + source: _MatOptionBase, isUserInput?: boolean); isUserInput: boolean; - source: _MatOptionBase; + source: _MatOptionBase; } // @public