3 ms·
TypeScript documentation for conditional types advertises the use of nested conditionals: https://www.typescriptlang.org/docs/handbook/advanced-types.html#cond
by nosianu 7y ago
TypeScript documentation for conditional types advertises the use of nested conditionals:
https://www.typescriptlang.org/docs/handbook/advanced-types.html#conditional-types https://www.typescriptlang.org/docs/handbook/advanced-types....
I must say that I find those examples clearly express what is going on.
Also, about another poster's comment, while it may be true that for regular code needing this may be a sign that the code needs refactoring, for business logic this is not true. You may very well end up with "business logic code" where things like huge functions and long nested conditionals actually are the optimal way to express messy reality, and that trying to use refactoring methods like "put this into extra functions" actually increases complexity.