dibbo
Aarktype
•Created by dibbo on 1/26/2025 in #questions
Intersection/Union Validation Errors
Yeah very true. The in-editor experience can be great when the branching kicks in, but I suppose it's all about balance.
Thanks David!
11 replies
Aarktype
•Created by dibbo on 1/26/2025 in #questions
Intersection/Union Validation Errors
Yeah I think using a single object would make life a lot easier in this scenario.
Honestly avoiding those kind of unions is actually good practice in every context both for runtime validation and within TS itselfIs this for performance or maintenance/our own sanity reasons?
11 replies
Aarktype
•Created by dibbo on 1/26/2025 in #questions
Intersection/Union Validation Errors
Ah, that makes sense, thanks for clarifying.
Slightly related: this came about because of errors I was seeing while using the
react-hook-form
resolver for ArkType - the error from rhf
wasn't specifying any key at all for errors in a (sort of) complex union/intersection type which was concerning. I noticed the resolver is using an outdated version of ArkType - do you think the lack of keys in the error feedback is because of the outdated library, or is there a chance the type is too complex to work out what's going wrong?
I appreciate there's a lot of unknowns in there, just thought I would raise it/ask 😄11 replies
Aarktype
•Created by dibbo on 12/18/2024 in #questions
Best way of sharing/compiling types?
Thats cool though, thanks for the reply! A monorepo might make more sense for this setup.. I'll draw up some pros and cons and see where I land haha
7 replies
Aarktype
•Created by dibbo on 12/18/2024 in #questions
Best way of sharing/compiling types?
Close enough! 😄
7 replies
Aarktype
•Created by dibbo on 11/3/2024 in #questions
Generic middleware validator
Thank you!
10 replies
Aarktype
•Created by dibbo on 11/3/2024 in #questions
Generic middleware validator
Hey @ssalbdivad I've updated https://github.com/bgribben/type-issue to use my own recursive type for the middleware
and I'm still seeing the issue with the following usage
The strange thing is if I move
handleUpdatePet
above handleCreatePet
, the error disappears
At a glance, would you know why the order of the calls impacts the output of TS?
Apologies for the direct ping, but if you get a second to check out the error in the repo, it would be greatly appreciated. Thanks!10 replies
Aarktype
•Created by dibbo on 11/3/2024 in #questions
Generic middleware validator
This might be an issue with the middy library, or at least how I'm using it. One call to
use
seems to impact the other e.g.
in this instance, commenting out the handleCreatePet
gets rid of the Type instantiation is excessively deep and possibly infinite
error in handleUpdatePet
.
I have no idea how they could impact each other, gonna do some digging to see if I'm even using the library correctly 🙃10 replies
Aarktype
•Created by dibbo on 11/3/2024 in #questions
Generic middleware validator
I think that should show the issue, thanks for looking into this
10 replies
Aarktype
•Created by dibbo on 11/3/2024 in #questions
Generic middleware validator
Sure. I've moved the call outside of the middleware chain i.e.
and I'm still seeing the error so I think we can rule out
use
/handler
interfering with it. Here are the other types
Here's a CodeSandbox link to the ark schemas and their usage10 replies
Aarktype
•Created by PIat on 9/17/2024 in #questions
Dynamic type based on another value
As always, thank you for the help 🙏
24 replies
Aarktype
•Created by PIat on 9/17/2024 in #questions
Dynamic type based on another value
Although thinking about it, I would also like to use it as a Type in the application, so I'm guessing I'll have to do the
or
ing24 replies
Aarktype
•Created by PIat on 9/17/2024 in #questions
Dynamic type based on another value
Runtime (I think - its used to validate incoming request bodies)
24 replies
Aarktype
•Created by PIat on 9/17/2024 in #questions
Dynamic type based on another value
Sure, 2 secs
24 replies
Aarktype
•Created by PIat on 9/17/2024 in #questions
Dynamic type based on another value
Is there an alternative approach to this available via arktype at all? I have run into a similar scenario but with many possible key/value combinations.
Rather than writing a specific type for each scenario and
or
ing them, can I configure a property to be required/optional based on the value(s) of other properties?24 replies
Aarktype
•Created by dibbo on 8/29/2024 in #questions
Optional property with const string array
Oh nice, I didn’t know that was an option. Thank you for the replies
6 replies
Aarktype
•Created by dibbo on 8/27/2024 in #questions
Indexed Access Types
Nice, thank you for the help!
9 replies
Aarktype
•Created by dibbo on 8/27/2024 in #questions
Indexed Access Types
Thank you! Good question... I've been looking at this for so long I can't remember 😂 Let me give a more detailed example: I'm trying to create a type to be used to validate the payload in a search request. I've landed on this as the implementation
I was wondering if there was a cleaner/preferred way to pick out the
value
prop from the size
array with arktype, rather than creating a new array via the map.9 replies