ahrjarrett
ahrjarrett
Aarktype
Created by ahrjarrett on 4/28/2025 in #questions
Can the output of `.json` be used to construct an arktype schema?
i've got a workaround here locally, but i'll follow that issue so i know when i can rip it out
36 replies
Aarktype
Created by ahrjarrett on 4/28/2025 in #questions
Can the output of `.json` be used to construct an arktype schema?
oh okay, that makes more sense. cool
36 replies
Aarktype
Created by ahrjarrett on 4/28/2025 in #questions
Can the output of `.json` be used to construct an arktype schema?
tbh, i'm not sure i understand hah. specifically i think the { undefined: [{ sequence: { prefix: [{ unit: 'undefined' }] } }] } bit is confusing me
36 replies
Aarktype
Created by ahrjarrett on 4/28/2025 in #questions
Can the output of `.json` be used to construct an arktype schema?
gotcha. yeah it'd be a pretty strange schema to write by hand
36 replies
Aarktype
Created by ahrjarrett on 4/28/2025 in #questions
Can the output of `.json` be used to construct an arktype schema?
default means default discriminant? not like, default value?
36 replies
Aarktype
Created by ahrjarrett on 4/28/2025 in #questions
Can the output of `.json` be used to construct an arktype schema?
36 replies
Aarktype
Created by ahrjarrett on 4/28/2025 in #questions
Can the output of `.json` be used to construct an arktype schema?
oh wow, i haven't seen the playground until now. nice!
36 replies
Aarktype
Created by ahrjarrett on 4/28/2025 in #questions
Can the output of `.json` be used to construct an arktype schema?
cool. thanks for everything you do!
36 replies
Aarktype
Created by ahrjarrett on 4/28/2025 in #questions
Can the output of `.json` be used to construct an arktype schema?
hah 😭 that shit
36 replies
Aarktype
Created by ahrjarrett on 4/28/2025 in #questions
Can the output of `.json` be used to construct an arktype schema?
cool. i'll raise the issue. unless you'd prefer i put it on reddit??
36 replies
Aarktype
Created by ahrjarrett on 4/28/2025 in #questions
Can the output of `.json` be used to construct an arktype schema?
not sure why the range constraint would change the behavior there. also not sure why, but the [type.undefined] is necessary too this doesn't come from an actual use case, this was a generated schema
36 replies
Aarktype
Created by ahrjarrett on 4/28/2025 in #questions
Can the output of `.json` be used to construct an arktype schema?
tl;dr
const schema1 = type.Record(
"string",
type("3 <= null[] <= 10").or('false').or([type.undefined])
)

const schema2 = type.Record(
"string",
type('null[]').or('false').or([type.undefined])
)

schema1({ a: false }) // => { a: false }
schema2({ a: false }) // => ArkErrors[]
const schema1 = type.Record(
"string",
type("3 <= null[] <= 10").or('false').or([type.undefined])
)

const schema2 = type.Record(
"string",
type('null[]').or('false').or([type.undefined])
)

schema1({ a: false }) // => { a: false }
schema2({ a: false }) // => ArkErrors[]
36 replies
Aarktype
Created by ahrjarrett on 4/28/2025 in #questions
Can the output of `.json` be used to construct an arktype schema?
i've got a possible bug -- going to open an issue for it, but wanted to double check here to make sure it isn't just user error on my part https://stackblitz.com/edit/vitest-dev-vitest-ddhwwn9j?file=test%2Frepro.test.ts
36 replies
Aarktype
Created by ahrjarrett on 4/28/2025 in #questions
Can the output of `.json` be used to construct an arktype schema?
awesome -- thank you!
36 replies
Aarktype
Created by ahrjarrett on 1/21/2025 in #questions
cross posting from #typescript
hey! do you have time at some point this week to take a look at the arktype generation stuff? would be helpful to know if there's a way i could be doing it better. i think i've got it all working together and playing nice. there's still an edge case involving isDivisibleBy that fast-check caught today, but it took ~100 runs before it found it, so I'm considering cutting an alpha version at creating a ticket for it
16 replies
Aarktype
Created by ahrjarrett on 1/21/2025 in #questions
cross posting from #typescript
cool, thank youuu you're the best
16 replies
Aarktype
Created by ahrjarrett on 1/21/2025 in #questions
cross posting from #typescript
yeah
16 replies
Aarktype
Created by ahrjarrett on 1/21/2025 in #questions
cross posting from #typescript
will .array() work in all cases?
16 replies
Aarktype
Created by ahrjarrett on 1/21/2025 in #questions
cross posting from #typescript
i'm doing this programmatically, so i need to make sure i'm able to detect when to use which syntax, in which context
16 replies
Aarktype
Created by ahrjarrett on 1/21/2025 in #questions
cross posting from #typescript
thanks for the quick response! hmm, i don't know if splitting it up is an option. let me try .array()
16 replies