How to fix An expression of type 'never' cannot be tested against a string, number, or other type in TypeScript | DevErrors