Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(typeahead): use readonly arrays for inputs (#2773) #3423

Merged
merged 1 commit into from Dec 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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