I am new to Type script and trying to remove duplicate objects based on property in my case its only id. I am trying to use filter but unable to do so. I have pasted my code below . Could any one please guide me. MY list is of type employee and i have created model class for employee.id can be duplicate because of some bad data and as work around i need to remove duplicate from list and show it to the UI.
I have tried to convert it to set but didn't work.
ids : Employee = new Array<Employee>(); this.list.filter((this.list=> ids.includes(this.list.idPk) ? false : ids.push(this.list.idPk));