How to fix Spread syntax may only be applied to Iterable types in TypeScript | DevErrors