Flosi21
Aarktype
•Created by nickmazuk on 4/19/2025 in #questions
`.configure` not being applied
Though I agree that intuitively configure should always override narrow 🤔
8 replies
Aarktype
•Created by nickmazuk on 4/19/2025 in #questions
`.configure` not being applied
You can actually configure them by returning ctx.reject({ message: "Your message"}) if I am not mistaken
8 replies
Aarktype
•Created by Flosi21 on 4/16/2025 in #questions
Discriminated union with union type discriminator gives wrong error messages
especially if i say have something like this type
and just want to explore the behaviour of intersectNodesRoot on the
option
prop54 replies
Aarktype
•Created by Flosi21 on 4/16/2025 in #questions
Discriminated union with union type discriminator gives wrong error messages
ok i think i will just try around a bit and get familiar with the disjoints and schema types, do you have any recommendations on how to best debug / run / explore the code. Just debugging into the unit tests?
54 replies
Aarktype
•Created by Flosi21 on 4/16/2025 in #questions
Discriminated union with union type discriminator gives wrong error messages
does domain also include something like
number < 10
or is this another type?54 replies
Aarktype
•Created by Flosi21 on 4/16/2025 in #questions
Discriminated union with union type discriminator gives wrong error messages
ok 👍
54 replies
Aarktype
•Created by Flosi21 on 4/16/2025 in #questions
Discriminated union with union type discriminator gives wrong error messages
if we only "accept" this case for simplicity this would be relatively simple, no?
- check if the union disjoint is between a single literal value and a union of literal values
54 replies
Aarktype
•Created by Flosi21 on 4/16/2025 in #questions
Discriminated union with union type discriminator gives wrong error messages
ah ok
54 replies
Aarktype
•Created by Flosi21 on 4/16/2025 in #questions
Discriminated union with union type discriminator gives wrong error messages
as far as my understanding goes it kindof describes the primitive type that can be express using typeof?
54 replies
Aarktype
•Created by Flosi21 on 4/16/2025 in #questions
Discriminated union with union type discriminator gives wrong error messages
hmm ok, that brings me to a question i have had for a long time, what exactly is a "domain" ? 😅
54 replies
Aarktype
•Created by Flosi21 on 4/16/2025 in #questions
Discriminated union with union type discriminator gives wrong error messages
could we check for a disjoint entry that is union kind and that that union only has branches of type "unit" ?
54 replies
Aarktype
•Created by Flosi21 on 4/16/2025 in #questions
Discriminated union with union type discriminator gives wrong error messages
*entry.kind
54 replies
Aarktype
•Created by Flosi21 on 4/16/2025 in #questions
Discriminated union with union type discriminator gives wrong error messages
so result.type would be a union here in that case?
54 replies
Aarktype
•Created by Flosi21 on 4/16/2025 in #questions
Discriminated union with union type discriminator gives wrong error messages
yeah without identifying the discriminant splitting them up before discrimination is not really feasible
54 replies
Aarktype
•Created by Flosi21 on 4/16/2025 in #questions
Discriminated union with union type discriminator gives wrong error messages
to be honest my main motivation in more powerful discrimination logic is actually the error messages, because they are much better if the union is discriminated 😅 especially if you want to transform them with onFail to apply custom error handling / messages
54 replies
Aarktype
•Created by Flosi21 on 4/16/2025 in #questions
Discriminated union with union type discriminator gives wrong error messages
hmm ok :/ even if the we limit these "discriminator unions" to be just unions of units strictly? So that they can always be transformed into a case?
54 replies
Aarktype
•Created by Flosi21 on 4/16/2025 in #questions
Discriminated union with union type discriminator gives wrong error messages
Ah i think we might be talking about different cases here. What is currently happening is that
is compiled to
what i am talking about is that something like this:
would be compiled to:
i think this does not exist in this form yet?
54 replies
Aarktype
•Created by Flosi21 on 4/16/2025 in #questions
Discriminated union with union type discriminator gives wrong error messages
wait what 😂
54 replies
Aarktype
•Created by Flosi21 on 4/16/2025 in #questions
Discriminated union with union type discriminator gives wrong error messages
not syntactically but if the switch performance degrades at a certain
N
and it is faster to leave the union undiscriminated the union could just not be discriminated if the discriminator union has more than N
options
Also i am currently thinking about implementing something, that would allow union discriminators that are strictly just unions of units because you could compile them to a switch without too many changes as far as i am aware. What do you think about that?54 replies
Aarktype
•Created by Flosi21 on 4/16/2025 in #questions
Discriminated union with union type discriminator gives wrong error messages
What bothers me more is a long union of units e.g. a | b | c | d | f | g | h | i | j | k, this could be compiled to one case per option but i guess you would have to limit the length of the union at some point?
54 replies