Equivalent of z.function from zod in shapeshift?
The title describes the issue
Solution:Jump to solution
there is no function validation yet in sapphire. I tried to add it a month or so ago and I was following instructions from @vladdy and @kyra but I had no idea what they were describing or how to implement it. I think either of them could add it in an afternoon given not procrastinating on it but alas.
The equivalent of safeParse is
.run(data: unknown): Result
: https://github.com/sapphiredev/shapeshift/#rundata-unknown-resultt-error-given-a-validation-you-can-call-this-method-to-check-whether-or-not-the which returns a Result
on which you can call .isOk()
/ isErr()
/ .unwrap()
...3 Replies
Additionally, what is the equivalent of
safeParse()
and .success
?
This is the code I am trying to convert to its shapeshift equivalent:
Solution
there is no function validation yet in sapphire. I tried to add it a month or so ago and I was following instructions from @vladdy and @kyra but I had no idea what they were describing or how to implement it. I think either of them could add it in an afternoon given not procrastinating on it but alas.
The equivalent of safeParse is
.run(data: unknown): Result
: https://github.com/sapphiredev/shapeshift/#rundata-unknown-resultt-error-given-a-validation-you-can-call-this-method-to-check-whether-or-not-the which returns a Result
on which you can call .isOk()
/ isErr()
/ .unwrap()
Understood, thank you!