10 Replies
This is working
Error:
Adding the type again fixes:
This however doesn't work:
I don't understand what's going on ðŸ˜
The only workaround I can come up with is to add the value twice and then wrap the data I want to parse
This is my workaround:
btw using ArkType version 1.0.29-alpha
This also works:
So it seems like any transform needs to be set at the top level first, and then the types can be validated in nested values
What I'm doing for now is adding this to the type:
Then created this function to transform the data before passing it to arktype:
Unsure if this is an arktype bug or if I'm using arktype wrong
@SynthLuvr Taking a look now. First off I wouldn't recommend transforming and returning both a result
0n
and an error- it should be one or the other
Have you tried 2.0.0? Just curious in case there is an issue that is likely where I'd fix itI haven't taken a look at v2. Is the learning curve steep? I did try upgrading the library but got a bunch of errors upon compilation so there must be breaking changes
There are breaking changes but all the syntax is the same so they should be easy to fix
I summarized the biggest items at the bottom of the announcement
Also the morph operator is now
=>
instead of |>
and narrow is now :
instead of =>
If you get through those and there are other issues feel free to ask.I changed to:
No issue there
You are right inferring out this nested transform is broken on alpha
Sorry about that, I'd recommend upgrading to 2.0 since I'm not publishing new alpha versions any more
@SynthLuvr Here's what I'd write on 2.0:
Thanks. Will try it out
It works
Great! There are a lot of other benefits as well I hope you enjoy it 😊
I was able to get v1 and v2 to run alongside each other, so will migrate over time
Just be careful not to use a 1.0 type as a 2.0 def or vice versa
Should be a type error anyways since the symbol prop should be unique