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
As you can see, it can return two possible objects, one with a something property which has content and that same objet with null in that property.
I want to use some utility types to pick the non null version of the something property. I tried the following:
But when I pass any object type with the generated type I still get errors telling me that empty (the null version) is not compatible with object (the thing the function is expecting).
How can I pick the right property of the right side of the sum type?
It can be seen how flow picks the property from the first value of the enum because if I try to nest picks (or elementypes) it says that null does not have any property:
I have a function with the following signature:
As you can see, it can return two possible objects, one with a
something
property which has content and that same objet with null in that property.I want to use some utility types to pick the non null version of the
something
property. I tried the following:But when I pass any object type with the generated type I still get errors telling me that empty (the null version) is not compatible with object (the thing the function is expecting).
How can I pick the right property of the right side of the sum type?
It can be seen how flow picks the property from the first value of the enum because if I try to nest picks (or elementypes) it says that null does not have any property:
Expected behavior
I expect to get a sum type of the nested property or being able to choose which side of the sum type I want to pick
Actual behavior
It picks the first value (in this case null) from the sum type
https://flow.org/try/#0C4TwDgpgBAQghgWwEYHsUEkB2wIHMBOcwAliplALxQAkAcmQLJwhIQAq4EAPAFBQ0BRADYQEEbB0i9+1YaPHBJ3PvxoBhOEKHTV-ABQBKSgD4Vu-gB8oAbwtnzugM4oxwABbFMuAFw37D3WJHNTJMCABjHAATX1QUEThMABp-AIBfFIDzIIAZFDgozx8oOITMVN0LNIqoK1sapxcIdyLfTABXLUys1Vz8wq9YtDKG2urdY27+ACJnVw8vaZVJ6zTTUx5QSCgAMRR8BC4AajZfagAlCAKAeUwhEC5V40obNZeLq6jb+8eVKKI4L42N19sRcJ5NAARAFnS43O4PNiTHhrHhozacKBYABWEWiAAV8CgwI5jqcaHCvgjHmtnlR6vwAGb7BC+PYHLgfeE-JHPKwANxQxCiKSqPAA9OKoABVEhCYigKBbaDuIhK9r4TCOKCJKDEkhkTRQfmadoqlA6qCYMh6sAGzBGsgQDHbNgoeiYa520gOoQvLhIvTKoFGCjPOiMZisJQBjbKqAhbBErQQKLshCE4mkpHva5IbFMMBcHF41OZkmxpJQN0er32zQbcJkRzABNkYDJkRpln+8uOWGfb4PJ5Vk4D7nDt70taGEyvNHxvsvaz2ZkHNksrjwZBoLA4AhEH2mao8Jta1sADxeiY78S76a4faS27ie7whHtxkMp+brZAvhfXdsHfQ8bSoABWcCgA
The text was updated successfully, but these errors were encountered: