DEV Community

Discussion on: Advanced TypeScript: reinventing lodash.get

Collapse
 
tipsy_dev profile image
Aleksei Tsikov

Unfortunately, TS doesn't support conditional operators, so it's not possible to concatenate a few expressions with &&. The only way I know is to extract each ternary operator into a dedicated type, similar to how it is done with FieldWithPossiblyUndefined and IndexedFieldWithPossiblyUndefined. But to my mind, it adds even more boilerplate.