How to fix Variable 'x' implicitly has type 'any[]' in TypeScript | DevErrors