Resources

// parseFooData defines validator, type and parser logic
// at the same time
const incommingFooData: any = { foo: "foo@example.com" }
const parsedFooData = parseFooData(incommingData)
// parseFooData is now of type Foo or an error was thrown