papy0977
Aarktype
•Created by papy0977 on 1/30/2025 in #questions
Fail fast on union type
Hi i try to fail fast on union type as i know if there is an error , it's pointless to continue checking the union and get the right message and not the full list of all union message.
For this i throw an error in the union branch and do a try catch on the type generated. Is there a clever/official way to do that:
40 replies
Aarktype
•Created by papy0977 on 1/25/2025 in #questions
Scope and narrow
Hello,
need to have nested objects but with only 1 key in each, i tried using narrow:
it doesnt work after 1st level, as i think i also need to narrow the "value" field.
9 replies
Aarktype
•Created by papy0977 on 1/24/2025 in #questions
Recursive type problem:
Hello,
I'm trying to define a recursive type with the library, but without success, i have the error remoteFieldSchema is unresolvable. What can i do:
const recTypes = type.module({
remoteFieldSchema: {
arguments: type({ "[string]": "string" }),
field: type({ "[string]": "remoteFieldSchema" }).optional(),
},
});
thanks in advance.6 replies
Aarktype
•Created by papy0977 on 1/20/2025 in #questions
Hi,
new to arktype, i have two questions:
1. i can't add a default for array ? like :
foo:"string[]=['bar']"
2. given a type with all it's default can i create a concrete object from this type with all the default like: const foo=type({bar:"number.integer=42"})
and get back const defObj={bar: 42}
5 replies