Refinement lost inside map
Closed this issue · 0 comments
maxsalven commented
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;
}
}