Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
`getOrElse` and `orElse` use self-types in order to support typed upper bounds.[0] In TypeScript 2.4, generic functions were checked more strictly[1]. This causes the implicit downward type cast to fail, so we explicitly invoke the cast in the method body. This workaround is backwards-compatible with TypeScript 2.3. Bounded polymorphism has been implemented[1], but true F-bounded polymorphism hasn't been. This means a type like `interface` Option<A, B = Option<A, B>> is invalid. Alternatively, we can solve this with a lower type bound, but these don't work against concrete classes[2]. --- We should also upgrade monapt's TypeScript dependency to 2.4, but there are unrelated errors compiling the tests. [0] microsoft/TypeScript#13337 [1] https://github.com/Microsoft/TypeScript/wiki/What%27s-new-in-TypeScript [2] microsoft/TypeScript#14520
- Loading branch information