Validates a function, by wrapping the function and checking its return value through
validateEquals function. If the return value does not match the expected type,
it returns IValidation.IError typed object. Otherwise there's no type error,
it returns IValidation.ISuccess typed object instead.
By the way, if what you want is not finding every type errors, but just finding
the 1st type error, then use assertEqualsReturn instead. Otherwise, what you
want is not only validating return value, but also validating parameters, you can use
validateEqualsFunction instead.
On the other hand, if you want to allow any superfluous properties, utilize
validateReturn or assertReturn instead.
Validates return value with strict equality.
Validates a function, by wrapping the function and checking its return value through validateEquals function. If the return value does not match the expected type, it returns IValidation.IError typed object. Otherwise there's no type error, it returns IValidation.ISuccess typed object instead.
For reference, IValidation.IError.path would be a little bit different with individual validateEquals function. If the IValidation.IError occurs from the return value, the path would start from
$input.return
.By the way, if what you want is not finding every type errors, but just finding the 1st type error, then use assertEqualsReturn instead. Otherwise, what you want is not only validating return value, but also validating parameters, you can use validateEqualsFunction instead.
On the other hand, if you want to allow any superfluous properties, utilize validateReturn or assertReturn instead.