3 ms·
Why does it have Either? Doesn't TypeScript have "A | B" style sum types?
by RedNifre 11mo ago
Why does it have Either? Doesn't TypeScript have "A | B" style sum types?
- seivan 11mo ago[dead]
- pshirshov 11mo agoEither is biased, union is not. Probably we should say "union" instead of sum, as typescript unions are not discriminated. string | string in typescript is exactly the same as just string, while Either[String, String] is a type which is exactly a sum of two string types. Plus Either is biased towards R, the happy path value.