How to fix Conditional type cannot reference type variable in constraint in TypeScript | DevErrors