I am trying to add the last piece of type in my function, but typescript complained whatever I do. I know there is a way to solve it, and need your help.
export const getPropertiesArray = <T extends object, K extends keyof T>(data: T[], property: K) => {
return data.map(item => item[property]).sort();
};
This is my function and I need to add a default value to property, in this case, the default value is "ID".