Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Union passing depends on the order of options #1455
I noticed you have some known issues with unions and are working on them. Here's another quite reduced case that fails:
If I move the array to the beginning of the union, it passes. Likewise, if I merge the two files, it passes.
so, the way Flow handles unions is to try each branch and choose whichever one succeeds as the resulting type; if none succeed, then it raises an error. the problem is that it currently defines "succeeds" as "doesn't fail." Due to the way Flow infers each file individually and then merges together the results across files,
this is something we've been trying to fix for a while and are currently prioritizing (cc @bhosmer).