Open newtang opened 6 years ago
In the example below doMoreStuff() is guaranteed to have string arguments, because checkArgs will throw otherwise.
doMoreStuff()
https://flow.org/try/#0PTACDMBsHsHcCgBEBXAzgUwASoC4CcBLAYx0QG555xkA7Eg6GzAE2gGUdlxwAKNdPAElmALgD8uQjQDmAGkzoAbuho5h4yQRkBKAN7wAkAaIALdEQDWAQTzTUfDEObylKtc20UjrALLQ86BxcvPxOLsqqwp7wAL6U1HQ4DEy+-oGc3A4C6poy4W45+FrSevCYmESMqNCQ6AB0MNJZYQoR7tFxVLT0jBVmljZ2zcL5kR4iitAEzJgApKbmFqj6BgS8AIShUSsGOCZ4cJg06LCYAKJ4B3g8iABCAIYzwojRBp2rG65jpUZ7B6fHU4XK43B4zL6kV5xGJAA
Predicates need to return booleans: try this
@jcready If it's a requirement that Predicates need to return booleans, would it be possible for Flow to allow throws in the function before the return statement like this example
In the example below
doMoreStuff()
is guaranteed to have string arguments, because checkArgs will throw otherwise.https://flow.org/try/#0PTACDMBsHsHcCgBEBXAzgUwASoC4CcBLAYx0QG555xkA7Eg6GzAE2gGUdlxwAKNdPAElmALgD8uQjQDmAGkzoAbuho5h4yQRkBKAN7wAkAaIALdEQDWAQTzTUfDEObylKtc20UjrALLQ86BxcvPxOLsqqwp7wAL6U1HQ4DEy+-oGc3A4C6poy4W45+FrSevCYmESMqNCQ6AB0MNJZYQoR7tFxVLT0jBVmljZ2zcL5kR4iitAEzJgApKbmFqj6BgS8AIShUSsGOCZ4cJg06LCYAKJ4B3g8iABCAIYzwojRBp2rG65jpUZ7B6fHU4XK43B4zL6kV5xGJAA