papy0977
Aarktype
•Created by papy0977 on 1/30/2025 in #questions
Fail fast on union type
Yep, i was expecting not to go the route of narrowing , just letting arktype do all the work of validating/branching 😉
Hope your release go well 🙂
40 replies
Aarktype
•Created by papy0977 on 1/30/2025 in #questions
Fail fast on union type
Hi,
Following our chat, is there a way to intercept an error ?
In my example the throw work because when it goes to narrow the branch is valid, but imagine i enter the branch _add, and there is an error on the operand i have no way to act here as the others branches (sub and mul) will be tried, but it pointless as i know it was an add branch.
40 replies
Aarktype
•Created by papy0977 on 1/30/2025 in #questions
Fail fast on union type
Thank you very much, i think i will go to sleep for some few hours now.
40 replies
Aarktype
•Created by papy0977 on 1/30/2025 in #questions
Fail fast on union type
like for example in my case i gave it an expression object and it validate and morph it into another shape. I don't know how describe. What i am doing is transforming a graphql AST into an SQL one
40 replies
Aarktype
•Created by papy0977 on 1/30/2025 in #questions
Fail fast on union type
can we use arktype as a parser validater, as arktype is already descending all branches for us ?
40 replies
Aarktype
•Created by papy0977 on 1/30/2025 in #questions
Fail fast on union type
yes it could be handy
40 replies
Aarktype
•Created by papy0977 on 1/30/2025 in #questions
Fail fast on union type
yes because if a part of an expression is not valid then the whole is also not
40 replies
Aarktype
•Created by papy0977 on 1/30/2025 in #questions
Fail fast on union type
ok will see what i can achieve as i'm not a type system expert 😉
40 replies
Aarktype
•Created by papy0977 on 1/30/2025 in #questions
Fail fast on union type
Ok thank you, i will keep it as this for the moment (or maybe it's not the way todo it as you say ?) and see how it's going. For the moment i put 3 operators, but when it will grows that will a hell of a chain or errors 😉
Thank you for your time.
40 replies
Aarktype
•Created by papy0977 on 1/30/2025 in #questions
Fail fast on union type
what's puzzle me is the error message i can't say at first sight what happens so that why i wanted to terminate early
40 replies
Aarktype
•Created by papy0977 on 1/30/2025 in #questions
Fail fast on union type
yes i know for the syntax thank you, i just wanted to have more control 😉
40 replies
Aarktype
•Created by papy0977 on 1/30/2025 in #questions
Fail fast on union type
yes i want to skip the check of other branch as it's poinless if i have enter for example the add branch and there is not enough operand there is no point to continue
40 replies
Aarktype
•Created by papy0977 on 1/30/2025 in #questions
Fail fast on union type
in my case it'not working as i have a message like:
my error is lost in all the union
40 replies
Aarktype
•Created by papy0977 on 1/25/2025 in #questions
Scope and narrow
Yes with jitless: true it works, thank you !
9 replies
Aarktype
•Created by papy0977 on 1/25/2025 in #questions
Scope and narrow
ok just try a simple tuple for the field, but got an error:
89 | return true
90 | }
91 | if (!ctx.seen.value2) {
92 | ctx.seen.value2 = []
93 | }
94 | return this.value2Apply(data, ctx)
^
TypeError: this.value2Apply is not a function. (In 'this.value2Apply(data, ctx)', 'this.value2Apply' is undefined)
at alias9Apply (node_modules/@ark/util/out/functions.js:94:28)
at structure169Apply (node_modules/@ark/util/out/functions.js:59:29)
at intersection601Apply (node_modules/@ark/util/out/functions.js:22:27)
at <anonymous> (node_modules\@ark\schema\out\node.js:22:18)
9 replies
Aarktype
•Created by papy0977 on 1/25/2025 in #questions
Scope and narrow
thanks will look if i can do something
9 replies
Aarktype
•Created by papy0977 on 1/25/2025 in #questions
Scope and narrow
Hi, what do you mean by using a tuple expression ?
9 replies
Aarktype
•Created by papy0977 on 1/25/2025 in #questions
Scope and narrow
so i tried:
the record is now rejected at runtime but:
1. i loose all the typing (
'dvalue' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions
)
2. get a warning Type of property '"[string]"' circularly references itself in mapped type 'validateObjectLiteral<{ readonly "[string]": "dvalue"; }...
9 replies