How to fix Rest parameter must be of an array type in TypeScript | DevErrors