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