You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the case of a union type for tuple (which, in the example above, I use to simulate a Maybe type), flow can't refine the type in the else branch even though we're guaranteed at that point that the shape of y is [null, number], yet it errors because it thinks it could be [Error, number].
Here's a very slight modification that causes the other branch to lose refinement:
I didnt look at those but I have run into it countless times so I know there are lots of unanswered mentions of it dating back many months. Just wanted to connect them for referencing
Minimal repro:
https://flow.org/try/#0PTAEAEDMBsHsHcBQAXAngBwKagLIENUAjTAHgBUA+UAXlAG0A7AV2mgBpQyBdUAH3oCiAJyGwhHZqy6JomZKFQAuXAWIlmAW2JCqtRi3agAjNMQBjWAwDO8uphEcAlj1qpEjyKAAU9oQEpQAG9EUFAQel8nF0ERMQkDaVCLa1hZADo4AHMfETSNTCsrPEzMAPCAZQALWBYAE1AAOQB5MlBfMUQAXzboK2xg0PC7B1BnGnpJQ01tRNBkq1TMDNhsxzTkWAAxRwAPTFqvACY-MrAqmuh65tb2oS6gA
In the case of a union type for tuple (which, in the example above, I use to simulate a
Maybe
type), flow can't refine the type in theelse
branch even though we're guaranteed at that point that the shape of y is[null, number]
, yet it errors because it thinks it could be[Error, number]
.Here's a very slight modification that causes the other branch to lose refinement:
https://flow.org/try/#0PTAEAEDMBsHsHcBQAXAngBwKagLIENUAjTAHgBUA+UAXlAG0A7AV2mgBpQyBdUAH3oCiAJyGwhHZqy6JomZKFQAuXAWIlmAW2JCqtRi3agAjNMQBjWAwDO8uphEcAlj1qpEjyKAAUjmtVqS0ACUoADeiKCgIPT24qDONIIiYhIG0pEW1rCyAHRwAOZesTkamFZWePmYIdEAygAWsCwAJqAAcgDyZKCxYogAvj3QVtjhkdF2DvEu9IGpWvbpoJlW2Zh5sIWOOciwAGKOAB6YzV4ATEE1YA1N0K2d3b1CA0A
The text was updated successfully, but these errors were encountered: