ssalbdivad
Aarktype
•Created by Tom on 1/20/2025 in #questions
How to ensure optimal discrimination of union types?
Yes ArkType will do this by default. If you want to see what the structure of the discriminated union looks like, you could try something like
myModel.internal.assertHasKind("union").discriminantJson
2 replies
Aarktype
•Created by Möhre on 9/12/2024 in #questions
Is there a way to parse Dates and date iso strings without losing toJsonSchema capabilities.
Yeah there is actually an open issue for this:
https://github.com/arktypeio/arktype/issues/1110
I think it would be a great addition!
22 replies
Aarktype
•Created by Sebaestschjin on 1/16/2025 in #questions
Recursive types and d.ts files
Another option would be precompiled type output for ArkType, which could potentially help eliminate the need to duplicate types but would be a bit more work to implement
8 replies
Aarktype
•Created by Sebaestschjin on 1/16/2025 in #questions
Recursive types and d.ts files
Unfortunately this is a bug/limitation of TypeScript.
TypeScript does not currently have a way to serialize anonymous cyclic types to
.d.ts
.
If you're not able to resolve between your projects (e.g. within a monorepo) directly to .ts
, my best recommendation would be:
Log/+1 a relevant TS issue- @Andarist not sure if you happen to know off the top of your head if where this is tracked.
Add support for explicitly declared scopes: https://github.com/arktypeio/arktype/issues/7918 replies
Aarktype
•Created by francis on 8/25/2024 in #questions
vscode intellisense errors on the same type definition in some files, but not others
Do these problems apply even to the latest versions of ArkType? Because of similar issues I converted all symbols to string literals which I expected to resolve most stuff like this.
10 replies
Aarktype
•Created by OnkelTem on 1/7/2025 in #questions
TypeScript first - is possible or not? Can't remember :)
Yeah there is, but it is still not a finalized part of the API, so do keep in mind it might still change slightly:
4 replies
Aarktype
•Created by Tom on 1/7/2025 in #questions
Can arktype drop data not covered by schema?
First of many 📚
8 replies
Aarktype
•Created by Tom on 1/7/2025 in #questions
Can arktype drop data not covered by schema?
You saw in that case there's a global config right?
8 replies
Aarktype
•Created by Jeffrey Konowitch on 1/2/2025 in #questions
`.and` with default, expected behavior?
But I can see how that could be tricky. merge is usually the way to go for combining properties anyways
4 replies
Aarktype
•Created by Jeffrey Konowitch on 1/2/2025 in #questions
`.and` with default, expected behavior?
Hmm yeah I'd say the newer version is accurate because you shouldn't really be able to intersect an optional or defaultable prop with a required prop and get anything other than a required prop
4 replies
Aarktype
•Created by Alan on 12/30/2024 in #questions
Filtering Array<unknown> to a type?
Generally
flatMap
is a good way to filter and map with a single function in JS:
3 replies
Aarktype
•Created by Bjorno on 8/27/2024 in #questions
Extending types similar to an interface
ArkType is complex internally but the goal is to make things as simple as possible externally which hopefully is a good trade off
98 replies
Aarktype
•Created by Bjorno on 8/27/2024 in #questions
Extending types similar to an interface
Yeah I think not cooking too hard for app code is probably good haha
98 replies
Aarktype
•Created by Bjorno on 8/27/2024 in #questions
Extending types similar to an interface
There's a lot of overlap for stuff like intersecting ranges which is really cool to see
98 replies
Aarktype
•Created by Bjorno on 8/27/2024 in #questions
Extending types similar to an interface
Advanced users mostly, but yeah. Like I said you're definitely underestimating TS before you get to know it 😊
I will say though even though ArkType mirrors TS, the philosophy of the type system itself is much closer to Cue
98 replies
Aarktype
•Created by Bjorno on 8/27/2024 in #questions
Extending types similar to an interface
In ArkType they are called prefix, optional, variadic and postfix
98 replies
Aarktype
•Created by Bjorno on 8/27/2024 in #questions
Extending types similar to an interface
That's a variadic element. There are also optional elements in TS/ArkType which is a single element that may or may not be present
98 replies
Aarktype
•Created by Bjorno on 8/27/2024 in #questions
Extending types similar to an interface
The more I see of their docs though it really does parallel arktype in a lot of ways in terms of these reductions.
If the underlying type system just can't represent as much it's hard to compare the unification
98 replies
Aarktype
•Created by Bjorno on 8/27/2024 in #questions
Extending types similar to an interface
So types like those from my example can't exist in the first place
98 replies
Aarktype
•Created by Bjorno on 8/27/2024 in #questions
Extending types similar to an interface
Yeah but they only support trailing rest elements and no optional
98 replies