ssalbdivad
ssalbdivad
Aarktype
Created by ahrjarrett on 4/28/2025 in #questions
Can the output of `.json` be used to construct an arktype schema?
No description
36 replies
Aarktype
Created by ahrjarrett on 4/28/2025 in #questions
Can the output of `.json` be used to construct an arktype schema?
But actually this discriminant is degenerate because once you include false you haven't discriminated anything
36 replies
Aarktype
Created by ahrjarrett on 4/28/2025 in #questions
Can the output of `.json` be used to construct an arktype schema?
It's saying if the value at 0 is undefined, , check that the root value is either [undefined] or a null[] (int his case it would have to be [])
36 replies
Aarktype
Created by ahrjarrett on 4/28/2025 in #questions
Can the output of `.json` be used to construct an arktype schema?
So the only problem is that default also needs to be grouped with undefined here
36 replies
Aarktype
Created by ahrjarrett on 4/28/2025 in #questions
Can the output of `.json` be used to construct an arktype schema?
No description
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 the ...s make the example a bit more confusing
36 replies
Aarktype
Created by ahrjarrett on 4/28/2025 in #questions
Can the output of `.json` be used to construct an arktype schema?
Definitely a good case to fix though! Glad you caught it
36 replies
Aarktype
Created by ahrjarrett on 4/28/2025 in #questions
Can the output of `.json` be used to construct an arktype schema?
But the combination of the array + tuple leads to a bad result here
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.e. check the value at path [0], then depending on which case it ===, apply the remaining checks
36 replies
Aarktype
Created by ahrjarrett on 4/28/2025 in #questions
Can the output of `.json` be used to construct an arktype schema?
This whole thing represents the way the discrimination works
36 replies
Aarktype
Created by ahrjarrett on 4/28/2025 in #questions
Can the output of `.json` be used to construct an arktype schema?
The problem is that in this case, default is equivalent to undefined, so the default case is never hit
36 replies
Aarktype
Created by ahrjarrett on 4/28/2025 in #questions
Can the output of `.json` be used to construct an arktype schema?
This is the discriminant
36 replies
Aarktype
Created by ahrjarrett on 4/28/2025 in #questions
Can the output of `.json` be used to construct an arktype schema?
{
kind: 'unit',
path: [ '0' ],
cases: {
undefined: [
{
sequence: {...},
proto: 'Array',
exactLength: 1
},
{
sequence: {...},
proto: 'Array'
}
],
null: { sequence: { unit: null }, proto: 'Array' },
default: { unit: false }
}
}
{
kind: 'unit',
path: [ '0' ],
cases: {
undefined: [
{
sequence: {...},
proto: 'Array',
exactLength: 1
},
{
sequence: {...},
proto: 'Array'
}
],
null: { sequence: { unit: null }, proto: 'Array' },
default: { unit: false }
}
}
36 replies
Aarktype
Created by ahrjarrett on 4/28/2025 in #questions
Can the output of `.json` be used to construct an arktype schema?
Ahh interesting, I see the issue
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 will probably see if I can fix this now, hopefully relatively simple 🙏
36 replies
Aarktype
Created by ahrjarrett on 4/28/2025 in #questions
Can the output of `.json` be used to construct an arktype schema?
It probably has something to do with discrimination
36 replies
Aarktype
Created by ahrjarrett on 4/28/2025 in #questions
Can the output of `.json` be used to construct an arktype schema?
Yeah that does look like a bug
36 replies
Aarktype
Created by 𝘵𝘳𝘢𝘮𝘱𝘰𝘹 on 4/25/2025 in #questions
Unsatisfiable type
MyType.from will check what you pass directly
17 replies
Aarktype
Created by errata on 9/10/2024 in #questions
template literal/backtick string types e.g. type T = `type-${string}`
Figured out the playground issue, will be fixed in the next release!
17 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