How to fix Tuple type 'X' of length 2 has no element at index 3 in TypeScript | DevErrors