I want to implement a sorting function that can take the value of an object using a key or function, but at the moment I can\'t infer the return value of the function that takes