You dont need lodash, you can do with plain JS using map

DEMO

const tags = [{
    "display": "tag1",
    "value": "tag1"
}, {
    "display": "tag2",
    "value": "tag2"
}]

var result = tags.map(a => a.display);
console.log(result);

Answer from Sajeetharan on Stack Overflow
๐ŸŒ
Webdevtutor
webdevtutor.net โ€บ blog โ€บ typescript-join-object-array-to-string
How to Join Object Array to String in TypeScript
In this example, we have an array of Person objects where each object has a name property. We use map to extract the name property and then join to join the names with a comma and space. Another method is to use the reduce function to build the final string by iterating over the array of objects.
Discussions

How do I convert a javascript object array to a string array of the object attribute I want? - Stack Overflow
Possible Duplicate: Accessing properties of an array of objects ... Are you sure you need to convert it to an array like that? Oftentimes, doing a conversion like this is an indication that you may be going about your underlying problem the wrong way. It might be useful to take a step back and make sure that's not the case here. ... @shauna my problem is this. im using bootstrap's typeahead it only access the second format: which is a array of string... More on stackoverflow.com
๐ŸŒ stackoverflow.com
Convert array of key:value pair objects to string
There are two main approaches for this. The first is pretty straightfoward: do the first bits, then join: data.map(({ name, value }) => `${name}=${value}`).join('/'); You first join the data into an array like this ['a=b', 'c=d', 'e=f'] than just use the String join() function to join those with slashes. The slightly fancier way would be to use .reduce(): data.reduce((str, { name, value }) => `${str}${str ? '/' : ''}${name}=${value}`, '') This one you're just adding each onto the string. This one is a little harder to read, but has the advantage of only one loop through the data instead of two like the other. Better if you're getting lots of data (hundreds or thousands of records). The ternary bit in there (?:) is simply to ensure you don't get a "/" at the start of the string. More on reddit.com
๐ŸŒ r/learnjavascript
9
2
March 19, 2021
[Question] Converting array of objects into a single object
๐ŸŒ r/typescript
9
5
June 5, 2021
How to Type an array that contains objects and strings
The linter is accepting it just fine. It's telling you that when you access items of the array they can be strings, and 'foo'.name doesn't exist. You need to refine the type if you want to do that, or... Advice: Just don't mix types in arrays More on reddit.com
๐ŸŒ r/typescript
8
7
April 9, 2022
๐ŸŒ
Webdevtutor
webdevtutor.net โ€บ blog โ€บ typescript-array-object-to-string
Converting TypeScript Array of Objects to String
One of the simplest ways to convert an array of objects to a string in TypeScript is by using the JSON.stringify() method.
๐ŸŒ
Webdevtutor
webdevtutor.net โ€บ blog โ€บ typescript-object-array-to-string-array
Converting TypeScript Object Array to String Array: A Comprehensive Guide
In the above code, we have an array ... in the stringArray. Another way to convert a TypeScript object array to a string array is by iterating over the objects using a forEach loop....
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ typescript โ€บ typescript_array_tostring.htm
TypeScript - Array toString()
TypeScript - null vs. undefined ... toString() method returns a string representing the source code of the specified array and its elements.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ typescript โ€บ typescript-array-tostring-method
TypeScript Array toString() Method - GeeksforGeeks
July 12, 2024 - Object ยท Operators ยท Union Types ยท Last Updated : 12 Jul, 2024 ยท The Array.toString() method in TypeScript is a built-in function used to convert an array and its elements into a string representation.
๐ŸŒ
TypeScript
typescriptlang.org โ€บ docs โ€บ handbook โ€บ 2 โ€บ objects.html
TypeScript: Documentation - Object Types
Generic object types are often some sort of container type that work independently of the type of elements they contain. Itโ€™s ideal for data structures to work this way so that theyโ€™re re-usable across different data types. It turns out weโ€™ve been working with a type just like that throughout this handbook: the Array type. Whenever we write out types like number[] or string[], thatโ€™s really just a shorthand for Array<number> and Array<string>.
Find elsewhere
๐ŸŒ
DEV Community
dev.to โ€บ mehmehmehlol โ€บ from-string-to-array-to-string-f67
From String to Array to String - DEV Community
April 23, 2021 - Object.assign() takes two arguments: target and source. In our case, our target is an empty array [] and our source is the given string (which is an enumerable/ can be iterated object). const str = "foo"; Object.assign([], str) // ['f', 'o', 'o'] Yay! It works... on the surface... If you move this to TypeScript...
๐ŸŒ
xjavascript
xjavascript.com โ€บ blog โ€บ typescript-object-to-string
Converting TypeScript Objects to Strings: A Comprehensive Guide โ€” xjavascript.com
Storage: When storing data in a file or a database, it may be necessary to convert the object to a string first. The most common way to convert a TypeScript object to a string is by using the JSON.stringify() method.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ how-to-convert-an-array-of-objects-into-object-in-typescript
How to Convert an Array of Objects into Object in TypeScript ? - GeeksforGeeks
September 16, 2024 - In TypeScript, we can iterate over the array of objects using various inbuilt loops and higher-order functions, We can use for...of Loop, forEach method, and map method.
๐ŸŒ
ReqBin
reqbin.com โ€บ code โ€บ javascript โ€บ ot8wzla9 โ€บ javascript-array-to-string-example
How do I convert array to string in JavaScript?
November 21, 2023 - The following are examples of converting an array to a string in JavaScript: The toString() method in JavaScript is a built-in method used to convert an object to a string representation.
๐ŸŒ
Reddit
reddit.com โ€บ r/typescript โ€บ [question] converting array of objects into a single object
r/typescript on Reddit: [Question] Converting array of objects into a single object
June 5, 2021 -

Basically what I'm trying to achieve is to convert an array like this:

 const params = [  
    { name: "name", type: "STRING" },  
    { name: "age", type: "INTEGER" },  
    { name: "admin", type: "BOOLEAN" }  
];  

into a type like this:

{ name: string, age: number, admin: boolean }

I've figured a way to convert individual objects into their proper representation like this:

type ParamType = "STRING" | "INTEGER" | "BOOLEAN";

type GetParamType<T extends ParamType> = 
    T extends "STRING" ? string :  
        T extends "INTEGER" ? number : 
            T extends "BOOLEAN" ? boolean : 
                never;

interface Param {
    name: string;
    type: ParamType
}

type GetTypeFromParam<P extends { type: ParamType }> = 
  P extends { type: ParamType } ? GetParamType<P["type"]> : never;
type GetNameFromParam<P extends { name: string }> = 
  P extends { name: string } ? P["name"] : never;

type FormatParam<P extends Param> = Record<GetNameFromParam<P>, GetTypeFromParam<P>>

type ParamTest = FormatParam<{ name: "test", type: "INTEGER" }> // { test: number }

But I can't figure out how to "concat" an array into a single object. Is there something I can do to achieve this or is it simply impossible to do?

Thanks in advance.

๐ŸŒ
Reddit
reddit.com โ€บ r/typescript โ€บ how to type an array that contains objects and strings
r/typescript on Reddit: How to Type an array that contains objects and strings
April 9, 2022 -

Hello everyone.

I'm having a hard time getting the linter to accept the typing of an array of mostly objects that can contain a string.

exampleArray:  [{id: 'abc', name: 'test2'},  {id: 'abc', name: 'test2'}, 'ALL'];

I have typed the array accordingly:

export interface ITest {
  id?: string;
  name?: string;
}

export type TestOption = ITest | string;

I can't get the tests to pass. Examples of the test outputs are found below:

#``1:

error TS2339: Property 'displayValue' does not exist on type 'string | ITest'.
  Property 'name' does not exist on type 'string'.

const labelId = `${multiple ? 'checkbox-' : ''}list-label-${option?.name || ''}`;

#2:

src/components/FilterSelect/index.tsx:274:142 - error TS2339: Property 'displayValue' does not exist on type 'string | ITest'.
  Property 'name' does not exist on type 'string'.

274                       <ListItemText classes={{ primary: classes.listItemText, root: classes.listItemTextRoot }} id={labelId} primary={option.name} />

If anyone has any advice or documentation that will help please send it my way! ๐Ÿ™

๐ŸŒ
Medium
kasama-chenkaow.medium.com โ€บ typescript-convert-array-of-object-to-object-with-id-as-a-key-81d012ca70c5
Typescript: Convert an array of objects to object with ID as a key and correct typing | by Kasama Chenkaow | Medium
September 1, 2023 - K : never; }[keyof T]; const arrayToKeyObject = <T extends Record<StringKeys<T>, string | number | symbol>, TKeyName extends keyof Record<StringKeys<T>, string | number | symbol>>(array: T[], key: TKeyName): Record<T[TKeyName], T> => Object.fromEntries(array.map(a => [a[key], a])) as Record<T[TKeyName], T> playground ยท Typescript ยท
๐ŸŒ
Bobby Hadz
bobbyhadz.com โ€บ blog โ€บ typescript-convert-object-to-array
How to Convert an Object to an Array in TypeScript | bobbyhadz
February 27, 2024 - We're basically unpacking the array's elements into variables. Note that the order is preserved. I've also written an article on how to convert an object to a JSON string.