Reference another schema type as default?
Hello, I'm relatively new to Arktype. I've managed to figure out most of our Zod migration, however I have a couple scenarios where I would like to reference other types as default values -or- compose a 'computed' property.
In this scenario I'd like to use the provided 'createdAt' value as the default 'modifiedAt' value:
And in this scenario, I'm doing some parsing prior to return an API payload. I would like to compose a type based off two other types:
Note : these are simplified examples
Both seem somewhat related, but I haven't figured out how or if it's possible to accomplish these.
2 Replies
You can morph the top-level object and transform the value directly:
Makes perfect sense! Thanks!