Skip to content

Commit

Permalink
feat(typeahead): use readonly arrays for inputs (#3423)
Browse files Browse the repository at this point in the history
  • Loading branch information
reduckted authored and maxokorokov committed Dec 6, 2019
1 parent 2c3f96a commit 36ce6fb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/typeahead/highlight.ts
Expand Up @@ -38,7 +38,7 @@ export class NgbHighlight implements OnChanges {
* The term or array of terms to be highlighted.
* Since version `v4.2.0` term could be a `string[]`
*/
@Input() term: string | string[];
@Input() term: string | readonly string[];

ngOnChanges(changes: SimpleChanges) {
const result = toString(this.result);
Expand Down
4 changes: 2 additions & 2 deletions src/typeahead/typeahead.ts
Expand Up @@ -135,7 +135,7 @@ export class NgbTypeahead implements ControlValueAccessor,
*
* Note that the `this` argument is `undefined` so you need to explicitly bind it to a desired "this" target.
*/
@Input() ngbTypeahead: (text: Observable<string>) => Observable<any[]>;
@Input() ngbTypeahead: (text: Observable<string>) => Observable<readonly any[]>;

/**
* The function that converts an item from the result list to a `string` to display in the popup.
Expand Down Expand Up @@ -367,7 +367,7 @@ export class NgbTypeahead implements ControlValueAccessor,
this._renderer.setProperty(this._elementRef.nativeElement, 'value', toString(value));
}

private _subscribeToUserInput(userInput$: Observable<any[]>): Subscription {
private _subscribeToUserInput(userInput$: Observable<readonly any[]>): Subscription {
return userInput$.subscribe((results) => {
if (!results || results.length === 0) {
this._closePopup();
Expand Down

0 comments on commit 36ce6fb

Please sign in to comment.