How can I clone/make a new type without caching?
I want to assign a sort of metadata and additional methods directly to the type value, however, due to types being cached, those assignments will exist on every instance of that type signature. Is there anyway to disable caching for a single type, or clone an existing type so it has a new reference?
Example of the sort of thing I want to do:
3 Replies
the most straightforward thing would be to just add some metadata using arktype's builtin concept- has some other benefits like type safety as well:
Even better, simply using .configure results in a new reference, cool
Yeah that was kind of what I meant that as long as the metadata is different it will generate different references. I thought maybe you'd want to have safety around the metadata that was being added, but if you need it at the top-level this is fine