I have an array of objects that corresponds to one interface, and I'm using a function that takes this kind of array and spits a different array of objects that corresponds to another interface
It can look something like this:
export const filterPagesById = (
items: FirstInterface[],
ids: string[],
): SecondInterface[] => items.filter((route) => ids.includes(route.id));
Typescript yells at me that type FirstInterface[] is not assignable to SecondInterface[].
The function does work properly and the array is transformed to the correct SecondInterface type. How can I "promise" Typescript that the function will indeed return the correct type?