Unexpected email and age: Error in Formatted Message
What's the best way to get a nice formatted message from the errors?
Something like "email: is unexpected"
Something like "email: is unexpected"
import * as S from "@effect/schema/Schema";
const Person = S.struct({
name: S.string,
age: S.number
});
S.parseSync(Person)(
{
name: "Bob",
age: "abc",
email: "bob@example.com"
},
{ errors: "all", onExcessProperty: "error" }
);
/*
throws
Error: error(s) found
├─ ["email"]
│ └─ is unexpected
└─ ["age"]
└─ Expected number, actual "abc"
*/