Hello wonderful community,
I am curious about how to properly define this specific type in Typescript. I have been contemplating whether Generics usage could help achieve this. Especially considering that the key for the object will always be different and not follow a normalized model.
{ status_id: { original: "A", new: "B" } },
It is important to note that 'status_id' is just an example and any field could be used instead.
export interface IParsedLog {
changes?: any; // Can someone guide me on defining this Type in Typescript?
date: Date;
}
const mock:IParsedLog[] = [
{
changes: [
{ status_id: { original: "A", new: "B" } },
{ any_field_id: { original: "A", new: "B" } },
],
date: '10-06-2020',
},
{
changes: [
{ supervisor_id: { original: "Jhon", new: "Jhony" } },
],
date: '10-06-2020',
}];