Best way to pass `Type` around
Hello! First, thanks for building this really cool library π I first heard of arktype while I was looking at the code of a framework called MUD, and while I was discussing CLI libraries with @frolic the other day, I thought that maybe it'd be a cool idea to have a CLI library that leverages arktype for arguments and options validation/parsing. I basically would like to have a function that receives args that are generated from arktype definitions. This is the code I have so far: 
8 Replies
The first version of the 
ArkType type's definition was actually type ArkType = Type, but for some reason narrows and morphs weren't passing the check T extends Type, so I had to use type ArkType = Type | Type<(_: any) => any>;
I guess my question is about what would be the best way to pass Type around and extract the out/infer type? I'm fairly new to arktype and I may not have made the best choice here πSeems like you'd better use definitions
What does 
validateAmbient do?Scopeless validateDefinition (with one generic arg)
Nice and concise, thanks βΊοΈ
Thanks! If I were to change your defineCommand definiton to the one below, how would you define 
args so that its props types all have the inferred types? 
I tried using inferAmbient, but narrows/morphs don't get "fully" inferred:
Type<inferAmbient<def>>.out or whatever the type()() return type isI changed it to 
run: (args: Type<inferAmbient<def>>["infer"]) => void; and it's working perfectly! Thanks for your help π