Fix incorrect type issues on options

This commit is contained in:
nathan 2022-05-13 09:01:44 -06:00
parent ace84d7953
commit de0c9aa3f4

View File

@ -144,13 +144,13 @@ export const Et2widgetWithSelectMixin = dedupeMixin((superclass) =>
* *
* @param new_options * @param new_options
*/ */
set select_options(new_options : SelectOption[] | { [key : string] : string }) set select_options(new_options : SelectOption[])
{ {
const old_options = this.__select_options; const old_options = this.__select_options;
if(!Array.isArray(new_options)) if(!Array.isArray(new_options))
{ {
let fixed_options = []; let fixed_options = [];
for(let key in new_options) for(let key in <any>new_options)
{ {
fixed_options.push({value: key, label: new_options[key]}); fixed_options.push({value: key, label: new_options[key]});
} }
@ -169,12 +169,12 @@ export const Et2widgetWithSelectMixin = dedupeMixin((superclass) =>
* @deprecated assign to select_options * @deprecated assign to select_options
* @param new_options * @param new_options
*/ */
set_select_options(new_options : SelectOption[] | { [key : string] : string }) set_select_options(new_options : SelectOption[] | { [key : string] : string }[])
{ {
this.select_options = new_options; this.select_options = <SelectOption[]>new_options;
} }
get select_options() get select_options() : SelectOption[]
{ {
return this.__select_options; return this.__select_options;
} }