A
arktype4mo ago
PIat

Get type without constraints

Hello! inferAmbient retuns types with constraints like moreThanLength<0>, which when I try to access values to, I get Type 'string' is not assignable to type 'moreThanLength<0>'. Is it possible to extract a more basic type?
11 Replies
ssalbdivad
ssalbdivad4mo ago
The easiest way externally is probably to wrap it in a type instance, then you access whatever version you need as a prop:
type outputOf<def> = Type<inferAmbient<def>>["infer"]
type outputOf<def> = Type<inferAmbient<def>>["infer"]
PIat
PIatOP4mo ago
Wow! Thank you, it's perfect! I am enjoying Arktype so much 😁
ssalbdivad
ssalbdivad4mo ago
I'm glad to hear that. I do think because it's such a unique API, it's more "fun" to use than most libraries haha
PIat
PIatOP4mo ago
Definitely. But also it makes sense, is super clean and clearly insanely flexible
ssalbdivad
ssalbdivad4mo ago
Yeah exactly that's what makes it so cool that I chose the API because I believe it's the best possible solution, but also the best possible solution just happens to be very different from anything else out there right now so it feels very novel
PIat
PIatOP4mo ago
I hope Typescript devs take some notes 🖊️
ssalbdivad
ssalbdivad4mo ago
I think if ArkType can become a staple in the ecosystem, it could open up the door for a next generation of APIs that leverage it either directly or employ a similar strategy to allow native types
PIat
PIatOP4mo ago
I was here I feel the same way Honestly, the last week of coding has been like a dream, like wow, it can be this comfortable
ssalbdivad
ssalbdivad4mo ago
That is really great to hear it's definitely what I'm aiming for! I just need to publish the remaining docs to make it more accessible to people who aren't as willing to to hack at it/come in the Discord and ask questions
PIat
PIatOP4mo ago
I'm just so thankful you're explaining all this to me 🙏
ssalbdivad
ssalbdivad4mo ago
Haha well it makes it a lot easier when you're so positive about everything that is very energizing!
Want results from more Discord servers?
Add your server