DEV Community

Discussion on: Toxic optionals - TypeScript

Collapse
 
captainyossarian profile image
yossarian

Agree, that optional properties is toxic.
Personaly, I think it is better to use discriminated unions. One optional property creates several condition statements

Collapse
 
latobibor profile image
András Tóth

It is also a case where using typescript and some good type narrowing clearly shines over vanilla js.