How to construct a new Type from an exiting Type's internal JSON representation? #1377
Unanswered
gabrielgrant
asked this question in
Q&A
Replies: 1 comment 2 replies
-
The limitations are non-serializable conditions. If your type includes At some point, I'd like to have a more robust story around how hydration could work in cases like that (could coincide with the work needed for #810). Until then, it feels like there are too many caveats and it is too much to ask a user to understand which conditions are serializable to officially support this. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Related to #1225 & #818
Type.toJSON()
/.json
return an internal representation of that type, parsed and reorganized from what is passed to `type():gives
@ssalbdivad has previously mentioned that this output "can already round trip for the most part".
passing
user.json
totype()
doesn't workpassing
user.json
torootSchema()
from@ark/schema
gives a type error (though does seem to work in this case if I ignore the TS error and run anyway?)Full error
const recreated = rootSchema(types.user.json)).
3. What are the limitations? (ie why is it "for the most part")
Beta Was this translation helpful? Give feedback.
All reactions