Given the following Object,
const document = {
id: 'f8bbe6dd-25e3-464a-90e2-c39038d030e5',
fields: {
lastname: 'TestLastName',
firstname: 'TestFirstName'
}
}
how can I transform it to an object of the interface Hit using typescript/javascript?
export interface Hit {
id: string;
fields: { [key: string]: string[] };
}
Expected result is as follows.
document = {
id: 'f8bbe6dd-25e3-464a-90e2-c39038d030e5',
fields: {
lastname: [
'TestLastName'
],
firstname: [
'TestFirstName'
]
}
}