Comment Comment by elnygren Good points!Seems like for "6. Optional properties"One should rather use tagged unions (see: Abstract Data Types, variants) that are usually written like this in TS: type Product = | { type: 'digital', id: string, sizeInMb: number } | { type: 'physical', id: string, weightInKg: number } At least I find it more elegant, concise and fun to work with :) parent elnygren 5 years ago
Seems like for "6. Optional properties"
One should rather use tagged unions (see: Abstract Data Types, variants) that are usually written like this in TS:
At least I find it more elegant, concise and fun to work with :)