diff --git a/src/components/select/bl-select.ts b/src/components/select/bl-select.ts index dbff82547..937ee168c 100644 --- a/src/components/select/bl-select.ts +++ b/src/components/select/bl-select.ts @@ -178,8 +178,9 @@ export default class BlSelect extends Form /** * Fires when selection changes */ - @event("bl-select") private _onBlSelect: EventDispatcher[]>; - + @event("bl-select") private _onBlSelect: EventDispatcher< + ISelectOption | ISelectOption[] + >; private _connectedOptions: BlSelectOption[] = []; private _cleanUpPopover: CleanUpFunction | null = null; @@ -441,16 +442,16 @@ export default class BlSelect extends Form } private _handleSelectEvent() { - this._onBlSelect( - this._selectedOptions.map( - option => - ({ - value: option.value, - selected: option.selected, - text: option.textContent, - } as ISelectOption) - ) + const selectedOptions = this._selectedOptions.map( + option => + ({ + value: option.value, + selected: option.selected, + text: option.textContent, + } as ISelectOption) ); + + this._onBlSelect(this.multiple ? selectedOptions : selectedOptions[0]); } private _handleSingleSelect(optionItem: BlSelectOption) {