// Do some transformation here or use some custom schema data types here.
const InputSchema = Schema.Struct({
x: Schema.Array(
Schema.Struct({
y: Schema.String
})
)
});
function test(input: unknown) {
const reified_input = Schema.decodeUnknownSync(InputSchema)(input);
console.log(reified_input.x._value[1]._value.y._path) // prints ["x", 1, "y"]
console.log(reified_input.x._value[1]._value.y._value) // prints "one"
}
test({ x: [{ y: "zero" }, { y: "one" }] })
// Do some transformation here or use some custom schema data types here.
const InputSchema = Schema.Struct({
x: Schema.Array(
Schema.Struct({
y: Schema.String
})
)
});
function test(input: unknown) {
const reified_input = Schema.decodeUnknownSync(InputSchema)(input);
console.log(reified_input.x._value[1]._value.y._path) // prints ["x", 1, "y"]
console.log(reified_input.x._value[1]._value.y._value) // prints "one"
}
test({ x: [{ y: "zero" }, { y: "one" }] })