-
Notifications
You must be signed in to change notification settings - Fork 1
Open
@pawaclawczyk
Description
At this moment Success::flatMap and Failure::recoverWith functions use function restrictCallableReturnType to check whether callable passed as argument has defined return type to TryCatch. It rises TypeError in case when return type is not defined or it is different than expected.
The proposal is to add checks enforcing also callable arguments types, ie example check input argument of callable passed to TryCatch::map or TryCatch::filter or similar functions. Type checks could be also used for checking consistency of functions passed to methods like TryCatch::transform.
Instead of using functions that throws TypeError directly we can introduce checkers returning boolean type and use them in combination with assert.