How to fix Property 'x' cannot be accessed on type 'never' in TypeScript | DevErrors