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
I want to fetch a bunch of those, that will give me Array<?Object>, then filter out those that don't match. That should produce Array<Object>. Say I want to do this:
functionfetchStuff(params: Array<string>): Array<Object>{// NOPE, Flow shouts at meconstmaybeObjs: Array<?Object>=params.map(maybeGet);returnmaybeObjs.filter(id=>id);// all nulls will get removed}
Would it be possible to permit something like this? Maybe some other neat way of replicating this behavior?
Let's say I have the following:
I want to fetch a bunch of those, that will give me
Array<?Object>
, then filter out those that don't match. That should produceArray<Object>
. Say I want to do this:Would it be possible to permit something like this? Maybe some other neat way of replicating this behavior?
Note:
I managed to do this via reduce:
but it's not really nice to do this all the time, when the filter verison is so much simpler.
The text was updated successfully, but these errors were encountered: