How to fix Cannot use 'X' as a value in TypeScript | DevErrors