Effect CommunityEC
Effect Community2y ago
16 replies
Toby

Error Reporting for Union types

I'm doing URL validation similar to this: https://github.com/effect-ts/effect/tree/main/packages/schema#url
I want to make the URL optional so used S.optional(NormalizeUrlString)
The problem is the error reporting. If i pass 'junk' the formatted error reports Expected undefined, actual "junk" which is obviously wrong.
It seems the individual components of a union are reported in isolation.
How can I change the error handling to be something like Expected undefined OR ...
Was this page helpful?