Flow: [flow v0.89] generic component prop is not inferred

Created on 11 Jan 2019  路  8Comments  路  Source: facebook/flow

This is simplified example of react-window tests which started to warn about empty type since flow v0.89
https://github.com/bvaughn/react-window/blob/master/src/test.js.flow#L38

https://flow.org/try/#0PTAEAEDMBsHsHcBQiCWBbADrATgF1AFSgCGAzqAEoCmxAxvpNrGqAOTY32sDcyuAnhiqUqAOwAmVbAGFmWUWNwAeACoA+UAF4RdXADpZmWAtG4VgqkoDeAH0ShQ44rmIAuUCoA0iGwF81vIgCQqAACkwYpKoa2rb2oLQAFijQ4hyi7tQSUobyitHeDii4VGgAIs5uHt5+gbTQZOQAYigAHlTiAMooAF5UADIopMrqoFStJRLk1Lp6oQCuHLnG+eGwkdEaVr7ItMbDJKSkUrgAopgCWqAAFABuxNDzVO6lGAIAlFpbvrx7ogeNE4AOXmaAARlIrncHk93KJQRDsJ9NN9fvt8IC8J1cNgUKIAOZQ+6PZ6gYa4gnI1HIKzxP4HACSJRY2muVkclVAvipoFpDgcmNwIPBUmuThc714-MOxyxOLx+LFlUl8QFRxO5ze-CVEtVoA4uEWolA8Og0ClXItSha7S6vQGQ3wxVKFRcmisAEZ-HqrEzSjsHEpgDaOt0+oNhgFEDsgA

/cc @jbrown215

soundness bug

Most helpful comment

This isn't something I can prioritize right now, but I have it on my list of bugs to investigate during the first week of April

All 8 comments

At first glance, nothing seems wrong with this behavior. Type type of data is a type variable upper bounded by number, string, and empty. I don't see where there should be a type error.

Can you explain?

I get it. It stopped working in 0.89. Could you run this example in 0.88? I expect it to fail in empty and string assertions.

The point is that data prop of Item component should be inferred from itemData prop of FixedSizeList. And this worked before.

@jbrown215 Any ideas about this? The easiest way to clone react-window repo and upgrade flow. Previously inferred types became empty and useless.

I think I see what you mean. Flow is giving data upper bounds of number, string, and empty and is giving T a lower bound of number. I'm not sure why the number is never getting compared against string and empty.

Hi @jbrown215. Any progress on this issue? Seems like it makes a lot of code in my app unsound. We got a lot of bugs in runtime lately.

This isn't something I can prioritize right now, but I have it on my list of bugs to investigate during the first week of April

Fixed in 0.99

Was this page helpful?
0 / 5 - 0 ratings