I am looking to automatically populate my object properties from a route query, but I am encountering a TypeScript error. Here is the code snippet I'm using:
const initialFilter = {
page: 1,
search: '',
min_date: '',
max_date: '',
min_price: '',
max_price: '',
};
const filter = ref<ExpenseFilterType>(initialFilter);
Object.entries(route.query).forEach((query) => {
filter.value[query[0]] = query[0] === 'page' ? parseInt(query[1] as string) : query[1];
});
Currently, I am getting the following error: https://i.sstatic.net/Ef9PI.png
I appreciate any assistance you can provide.