Hacker News new | ask | show | jobs
by johnfn 3354 days ago
I'd be curious in which ways flow is more intelligent than TS.
2 comments

Here are some examples: TS: https://www.typescriptlang.org/play/#src=type%20TA%20%3D%20%... Flow: https://flow.org/try/#0PQKgBAAgZgNg9gdzCYAoVAXAngBwKZgCSAgmA...

With Typescript, you have to write custom Type Guards functions, whereas Flow is smart enough to infer type

If you use discriminated union types - e.g. give them both a type key which is a unique string, then you don't need type guards as typescript is smart enough to understand that checking the type key does the type discrimination.
Sure, but you don't always have control over an external module or service, and it still something flow is better at
Yeah, that's true. I don't know why you've been downvoted. You have a legitimate answer.
Me too. I don't really see how you can get any smarter with union types than with TS 2.2+