diff --git a/ember-power-select/src/components/power-select.ts b/ember-power-select/src/components/power-select.ts index e6de6bd9e..884f570d8 100644 --- a/ember-power-select/src/components/power-select.ts +++ b/ember-power-select/src/components/power-select.ts @@ -38,8 +38,8 @@ interface SelectActions extends DropdownActions { export interface Select extends Dropdown { selected: any; highlighted: any; - options: any[]; - results: any[]; + options: readonly any[]; + results: readonly any[]; resultsCount: number; loading: boolean; isActive: boolean; @@ -66,7 +66,7 @@ export interface PowerSelectArgs { noMatchesMessageComponent?: string | ComponentLike; matchTriggerWidth?: boolean; resultCountMessage?: (resultCount: number) => string; - options?: any[] | PromiseProxy; + options?: readonly any[] | Promise; selected?: any | PromiseProxy; destination?: string; closeOnSelect?: boolean; @@ -114,7 +114,10 @@ export interface PowerSelectArgs { typeAheadOptionMatcher?: MatcherFn; buildSelection?: (selected: any, select: Select) => any; onChange: (selection: any, select: Select, event?: Event) => void; - search?: (term: string, select: Select) => any[] | PromiseProxy; + search?: ( + term: string, + select: Select, + ) => readonly any[] | Promise; onOpen?: (select: Select, e: Event) => boolean | undefined; onClose?: (select: Select, e: Event) => boolean | undefined; onInput?: (term: string, select: Select, e: Event) => string | false | void; @@ -165,11 +168,11 @@ export default class PowerSelectComponent extends Component; + private _lastOptionsPromise?: Promise; private _lastSelectedPromise?: PromiseProxy; - private _lastSearchPromise?: PromiseProxy | CancellablePromise; + private _lastSearchPromise?: + | Promise + | CancellablePromise; private _filterResultsCache: { results: any[]; options: any[]; @@ -501,7 +506,7 @@ export default class PowerSelectComponent extends Component; + this._lastOptionsPromise = currentOptionsPromise; this.loading = true; this._lastOptionsPromise .then((resolvedOptions) => { @@ -791,7 +796,7 @@ export default class PowerSelectComponent extends Component