I am new to typescript. please help to push the data so here it goes Here the story goes I have string array and i need to push it to the json object
interface LocalIds {
value: string;
label: string;
}
const localIds = [
{ value: 'test', label: 'test' },
{ value: 'test2', label: 'test2' },
];
////////////// HERE in string array that data is coming ///////////
const localIdentifiers: string[] = result.data.map((item: string) => item);
///////////// I want to push the string array data to json object with label & value//////
// I experimented alot but giving some type error and all I am not getting
localIds.push({ label: 'abc', value: 'abc' });
localIdentifiers.map(i => localIds.push(...localIds:{value:i,label:i}[])); //ERROR
JSON.stringifyto convert an object to JSON