Open pke opened 5 years ago
Note that using withValidate
like this raises a problem: is
and decode
are not coherent
console.log(Efficiency.is(-10)) // true
Hmm... and what would be the solution to make this work? It should be a guard or something?
@pke I would use t.intersection and show only the first error.
const NonEmptyTrimmedStringMax5 = t.intersection([
// For 'Invalid string.' message.
String,
NonEmptyString,
Trimmed,
Max5,
]);
š Feature request
Current Behavior
Multiple validation are somewhat verbose to write for custom types:
Desired Behavior
Suggested Solution
My solution with
pipe
and this implementation ofvalidate
It does not work though as
pipe
is complaining about incompatible args. It would also be nice to get rid of theNumberFromString.validate
call, and make this somehow implicit.Being new to FP I am lost here.
Who does this impact? Who is this for?
It would benefit advanced users I guess.