4 ms·
> although Typescript's union types are definitely much more ergonomic meh. Doing tricky stuff with them is far easier as TS is a dynamic language, but the fac
by lights0123 6y ago
> although Typescript's union types are definitely much more ergonomic
meh. Doing tricky stuff with them is far easier as TS is a dynamic language, but the fact that enum variants are each a variant makes constructing them really easy:
let array = [1, 2, 3];
let some_array: Option<i32> = array.iter().map(Some).collect();