Flow: React.Children.map errs with read-only type message

Created on 18 Aug 2017  路  1Comment  路  Source: facebook/flow

I was very happy about hearing about the new feature for typing react children, but it doesn't seem to work in combination with React.Children.map, or at least I don't know how to get it working. I have prepared two examples to illustrate that:

The first one shows that flow complains as soon as I am accessing a property of the untyped child parameter in the callback of React.Children.map. I am not sure how that should work out...

I have also tried to type the parameter, as shown in the second example I get an even stranger error including some $NonMaybeType, which I absolutely don't understand (should just not be null, as far as I see...). But in an ideal world that shouldn't be necessary at all, because flow can interfere the type, right?

Any help is appreciated 馃槂

Most helpful comment

Thanks for reporting! This is a bug. We鈥檒l have a fix out in the next version of Flow 馃槉

>All comments

Thanks for reporting! This is a bug. We鈥檒l have a fix out in the next version of Flow 馃槉

Was this page helpful?
0 / 5 - 0 ratings

Related issues

john-gold picture john-gold  路  3Comments

cubika picture cubika  路  3Comments

funtaps picture funtaps  路  3Comments

bennoleslie picture bennoleslie  路  3Comments

mmollaverdi picture mmollaverdi  路  3Comments