Micha
Aarktype
•Created by Micha on 2/5/2025 in #questions
Why is the generic expecting 3 options, although there is only one generic prop?
If I remove
extends queryValueObject = Record<string, never>
I only need 1 options. If I remove extends queryValueObject
, it goes up to 4 options. And if I remove only = Record<string, never>
, it also goes down to 1 required option.5 replies
Aarktype
•Created by Micha on 2/4/2025 in #questions
scope() how to bypass circular reference error?
I've implemented with Scope() successfully circular references, but somehow, I hit a limitation as this one still throws a circular reference error:
Error:
14 replies
Aarktype
•Created by Micha on 2/4/2025 in #questions
How to integrate generics with extend that need to access a type in scope?
queryValueObject is currently not resolving, and I assume it's because
type()
is creating its own scope. The question is, how can I solve it then?
I also tried it by wrapping it into []
, but this does also not work 🤔
15 replies
Aarktype
•Created by Micha on 2/4/2025 in #questions
How to create the Typescript type from a generic?
7 replies
Aarktype
•Created by Micha on 2/3/2025 in #questions
Is there a way to preserve jsdoc in arktype?
I have this piece of code:
At the moment the TS type
Role
don't have JsDoc as part of Intellisense. Also, role
has only the overall jsdoc, but not for the key membership
& privileges
2 replies
Aarktype
•Created by Micha on 2/3/2025 in #questions
What is the arktype 2 syntax for inferring classes with a private constructor?
In Arktype 1.x I was writing:
But the
Infer
import is not more available in arktype 2, so I'm wondering how to achieve it now?
Maybe the answer could be also added to the docs 🙂 https://arktype.io/docs/objects#instanceof6 replies
Aarktype
•Created by Micha on 2/3/2025 in #questions
How to create an array of type.instanceOf?
This doesn't work:
I only get it working without an array:
4 replies
Aarktype
•Created by Micha on 3/17/2024 in #questions
How to specify a property of type function?
In Typescript I have defined it like this:
But how to achieve the same in Arktype?
PS: Are there any soon plans to extend the Website with more examples? (e.g. the keyword page to explain how they need to be used e.g.
Function
) I experience it as quite hard to find answers through the discord search.11 replies
Aarktype
•Created by Micha on 3/16/2024 in #questions
Why scope().compile().infer resolves to any?
I tried to follow the example here: https://arktype.io/docs/scopes
Not sure if this is a bug or if I'm doing it wrong
Stackblitz: https://stackblitz.com/edit/rzkceh-eodur9?file=demo.ts%3AL63,index.ts
15 replies
Aarktype
•Created by Micha on 3/15/2024 in #questions
How to Union in scope()?
Union 1 will be resolved as I would expect to
ts?: string | TimeStub | undefined;
:
But Union 2
will be resolved to
although I would expect something like user: User | TimeStub
If I'm trying to do the same with the base union syntax that I found
"ts?": "string|['instanceof', TimeStub] as Infer<TimeStub>"
I get a type error
https://stackblitz.com/edit/rzkceh-eodur9?file=demo.ts6 replies
Aarktype
•Created by Micha on 3/15/2024 in #questions
How to include an external class into an arktype type?
I tried
and
but both create a Type<never> for me.
I'm using arktype 1.0.29-alpha
21 replies
Aarktype
•Created by Micha on 3/1/2024 in #questions
Are you recommending to create first ArkType types and derive from their TS types or vice versa?
Are you recommending to create first ArkType types and derive from their TS types or vice versa?
2 replies