Effect CommunityEC
Effect Community3y ago
123 replies
Kristian Notari

Schema Fallback Combinator

Is there a "withDefault" combinator for schema which is not linked to an optional property? Like a "fallback" more than a default, in the case the main schema fails to parse/decode?

For example, I'd like to retrieve a number but if it's a string I don't want an error, like current behviour for struct properties with Schema.optional(...).withDefault, but I'd like it to pass anyway returning my "fallback" value.
Was this page helpful?