How to fix Cannot destructure into a non-binding pattern in TypeScript | DevErrors