-
With a schema like this: const schema = Type.Object({
myField: Type.Union([t.Null(), t.String()]),
); I'm looking for some way to get Typebox to cast empty strings to const converted = Value.Convert(schema, {myField: 'howdy'});
// -> I want {myField: 'howdy'}. This works today.
const converted = Value.Convert(schema, {myField: ''});
// -> I want {myField: null}. This doesn't work. Neither |
Beta Was this translation helpful? Give feedback.
Answered by
EvHaus
Jul 25, 2024
Replies: 1 comment
-
I think I found my answer --
And now it works. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
EvHaus
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think I found my answer --
Type.Transform
. I changed my schema to:And now it works.