They have the crazy constraint of being 100% compatible with Javascript, which is a bit broken by design and yet they managed to make it so much better to work with TS than with JS.
After trying Flow numerous times, I came to the conclusion it simply can't compete with the power of the team Microsoft put together. Even their alpha versions are stable enough to be used in production.
Some advices:
- Always enable --noImplicitAny and --strictNullChecks. Without these flags, the type system is barely better than using JS.
- Use a noAny tslint rule. disable it on a case by case basis, only in util code. Most of the time, any is not necessary, often you can use {} or Object instead.
- You can get away with just using undefined everywhere, null adds no value.
- Use union types. Make impossible data combinations impossible to write! Example:
export type RemoteData<D, E> = NotAsked | Loading | Refreshing<D> | Success<D> | Failure<E>