Open ishyevandro opened 1 year ago
Angular version: 13.3.11
ng-multiselect-dropdown version: 0.3.9
Description of issue: Problem understanding how "onFilterChange" signature should work.
In this case, It looks like the right emit should be of type ListItem.
Steps to reproduce:
<ng-multiselect-dropdown [placeholder]="placeholder" [settings]="dropdownSettings" [data]="options" [(ngModel)]="selectedItems" (onFilterChange)="onFilterChange($event)" (ngModelChange)="onSelectionChange()" [disabled]="disabled" > </ng-multiselect-dropdown>
Not compiling because of "error TS2345: Argument of type 'ListItem' is not assignable to parameter of type 'string'."
onFilterChange(search: string) { console.log(typeof search); this.searchChange.emit(`${search}`); }
Working but not respecting type and with an eslint error. @typescript-eslint/no-base-to-string
onFilterChange(search: ListItem) { console.log(typeof search); //string this.searchChange.emit(`${search}`); }
Expected result: onFilterChange receive an object of ListItem
Actual result: onFilterChange receiving a string
Demo: Please share sample code link using StackBlitz or codesandbox
Angular version: 13.3.11
ng-multiselect-dropdown version: 0.3.9
Description of issue: Problem understanding how "onFilterChange" signature should work.
In this case, It looks like the right emit should be of type ListItem.
Steps to reproduce:
Not compiling because of "error TS2345: Argument of type 'ListItem' is not assignable to parameter of type 'string'."
Working but not respecting type and with an eslint error. @typescript-eslint/no-base-to-string
Expected result: onFilterChange receive an object of ListItem
Actual result: onFilterChange receiving a string
Demo: Please share sample code link using StackBlitz or codesandbox