Typescript parameters - a generic array of objects and array of object's keys (partial)
问题 I want to have a method that accepts an array of objects and an array of some of the objects keys. The method will return an array of arrays of object values but only of the selected keys. data: [ {"firstName": "Jane", "lastName": "Doe"}, {"firstName": "John", "lastName": "Doe"} ] fields: ["firstName"] result: [["Jane"], ["John"]] By now I have a function that provides desired outcome but I am not sure how to handle the types better. mapToCsvData: (data: { [key: string]: any }[], fields: