interface ProductType {
id: string;
name: string;
code: number;
category: string;
quantity: number;
dates: {
createdAt: number;
mfd: number;
exp: number;
};
}
interface ProductType {
id: string;
name: string;
code: number;
category: string;
quantity: number;
createdAt: number;
mfd: number;
exp: number;
}
const newArray = originalArray.map(({ dates, ...rest }) => ({
...rest,
...dates
}));