When using lodash v4.17.10, I encountered the error:
'LoDashExplicitWrapper<string[]>' is not assignable to type 'string[]'. Property 'length' is missing in type 'LoDashExplicitWrapper<string[]>.'
.
In my scenario, I have an array of objects and I am attempting to extract an array containing only the unique values of a specific property from each object.
The following code snippet illustrates my approach:
let carMakes: string[]
const inventory = [
{ make: "ford", model: "Focus" },
{ make: "ford", model: "F-150" },
{ make: "chevy", model: "Camaro" }
carMakes = _.chain(inventory)
.map('make')
.uniq()
I am curious if there is a way to achieve this desired functionality using method chaining in lodash. While it appears to provide an elegant solution, I have been unsuccessful in implementing it within my Angular project.