The issue arises with the error message: "Argument of type '(oldData: any) => any[]' is not assignable to parameter of type 'Trade[]'.ts". However, upon hovering over "update", it displays: "update: (value: Trade[]) => void", which appears correct to me.
export const trades: Writable<Trade[]> = writable([] as Trade[], function start(update) {
streamer.on("polyTrades", (trades: Trade[]) => {
update((oldData) => {
const updateData = [ ...oldData, ...trades ]
return updateData
})
})
return function stop() {
streamer.off("polyTrades")
}
})
I have attempted to assign a type to "oldData" without success. It seems like this may be related to Svelte. Is there a straightforward solution to resolve this issue without resorting to //@ts-ignore?