Type refinements seem to be lost inside an Array.map call:
/* @flow */
type Action =
| {
flag: true,
other: true,
}
| {
flag: false,
};
function reducer(action: Action): any {
switch (action.flag) {
case true:
// return action.other; // This is ok
return [1].map(item => action.other); // This is not
default:
return;
}
}
Type refinements seem to be lost inside an Array.map call:
https://flow.org/try/#0PQKgBAAgZgNg9gdzCYAoVAXAngBwKZgCCAxhgJZwB2YAvKmGAD5gDe9DHsAhgOYBcYDACcArngA07DmDgYAFniEDhYydIC+7Zm2kNu-MFC4wAzhKlh1AbnRQRlUhWpC8AExHFFACi6OqAknIqAEoBLkosVnYTBDIMYjkwHz9KADp9YKjpYi4zQVE8PgsGYGAwFwwRIWpfILTZBSErMFKwABU5MhMwLpkAa2LyvErqsABtAEYAXVSAWy4cLzi8WdoAPjBap1SGxWDm1o7e3spZC1c8IxEYDCLdIZHKGwZNTSA