jacksteamdev
Aarktype
•Created by jacksteamdev on 11/9/2024 in #questions
Union Fallthrough?
I think what I was looking for was essentially
if ... else
support for string matching:
Maybe subset matching... but I got there in the end.16 replies
Aarktype
•Created by jacksteamdev on 11/9/2024 in #questions
Union Fallthrough?
@TizzySaurus Thanks for the help!
I wasn't able to get
type("keyof", weightAliases)
working, it requires weightAliases to be a Type, as is it can't resolve the property values.
I was able to reduce casting with type.enumerated(...weightNames)
and an Object.keys wrapper:
16 replies
Aarktype
•Created by jacksteamdev on 11/9/2024 in #questions
Union Fallthrough?
Right now I'm wrapping it in a function:
Which works, but I was curious if there was a better way to do it.
16 replies
Aarktype
•Created by jacksteamdev on 11/9/2024 in #questions
Union Fallthrough?
It's not exactly a minimal repro, sorry 😓
16 replies
Aarktype
•Created by jacksteamdev on 11/9/2024 in #questions
Union Fallthrough?
This is
toStringUnion
:
16 replies
Aarktype
•Created by jacksteamdev on 11/9/2024 in #questions
Union Fallthrough?
Hi @TizzySaurus !
My goal is to normalize recipe ingredient measurements before writing to the db. Later I have an SQL function that combines ingredients from different recipes into a grocery list.
16 replies
Aarktype
•Created by jacksteamdev on 8/8/2023 in #questions
How to validate that a value is an instance of a class
do you want an issue for it, or do you think it's covered already?
23 replies
Aarktype
•Created by jacksteamdev on 8/8/2023 in #questions
How to validate that a value is an instance of a class
lol, at least there's a workaround, no matter how ugly 👹
23 replies
Aarktype
•Created by jacksteamdev on 8/8/2023 in #questions
How to validate that a value is an instance of a class
here's a fun one with private properties: https://stackblitz.com/edit/arktype-bug-rxgdqa?file=demo.ts
23 replies
Aarktype
•Created by jacksteamdev on 8/8/2023 in #questions
How to validate that a value is an instance of a class
Nice, thanks!
23 replies
Aarktype
•Created by jacksteamdev on 8/8/2023 in #questions
How to validate that a value is an instance of a class
I came up with something like this:
23 replies