JameEnder
Explore posts from serversAarktype
•Created by JameEnder on 9/22/2024 in #questions
Automatic "full" discriminated union
I'll test it out later today and let you know
23 replies
Aarktype
•Created by JameEnder on 9/22/2024 in #questions
Automatic "full" discriminated union
Neat
23 replies
Aarktype
•Created by JameEnder on 9/22/2024 in #questions
Automatic "full" discriminated union
It seems weird that the library can't do it on its own
23 replies
Aarktype
•Created by JameEnder on 9/22/2024 in #questions
Automatic "full" discriminated union
That seems like a working solution, yet i wanted to reduce the complexity, not the other way around :D
23 replies
Aarktype
•Created by JameEnder on 9/22/2024 in #questions
Automatic "full" discriminated union
That's useful, just not for solving this specific issue :D
23 replies
Aarktype
•Created by JameEnder on 9/22/2024 in #questions
Automatic "full" discriminated union
Tried both to add the + field to each definition, or apply the onUnknownKey to the final Input, and both dont fix the issue
23 replies
Aarktype
•Created by JameEnder on 4/12/2024 in #questions
Export type to JSON and share it
maybeParseSchema
sounds silly, but gets the message across the best imo119 replies
Aarktype
•Created by JameEnder on 4/12/2024 in #questions
Export type to JSON and share it
But on that note I don't know what the best naming practices in JS space are, so thats more of a feeling than anything
119 replies
Aarktype
•Created by JameEnder on 4/12/2024 in #questions
Export type to JSON and share it
I'm not sure about the "try" part, as that atleast to me implies that I should use a try catch block if the parsing fails, which isn't the case, because it returns the error as value without throwing
119 replies
Aarktype
•Created by JameEnder on 4/12/2024 in #questions
Export type to JSON and share it
That looks great
119 replies
Aarktype
•Created by JameEnder on 4/12/2024 in #questions
Export type to JSON and share it
Right, also I love the return error as value with
type
, I miss it a lot when I switch from Rust to TS119 replies
Aarktype
•Created by JameEnder on 4/12/2024 in #questions
Export type to JSON and share it
But at that moment, I'd assume you would just do
JSON.parse
and use type
, idk119 replies
Aarktype
•Created by JameEnder on 4/12/2024 in #questions
Export type to JSON and share it
But that could be misleading, as you could just parse a json of
{"field": "number"}
and it would not work as you could expect119 replies
Aarktype
•Created by JameEnder on 4/12/2024 in #questions
Export type to JSON and share it
That's fine by me, maybe exporting the
schema
fn as something more verbose would be good for newcomers? Something like typeFromJson
or similar119 replies
Aarktype
•Created by JameEnder on 4/12/2024 in #questions
Export type to JSON and share it
And it would have to stay that way, as functions just cant be serialized because of potential external dependencies inside the fn body
119 replies
Aarktype
•Created by JameEnder on 4/12/2024 in #questions
Export type to JSON and share it
Yeah that makes sense
119 replies
Aarktype
•Created by JameEnder on 4/12/2024 in #questions
Export type to JSON and share it
Got you
119 replies
Aarktype
•Created by JameEnder on 4/12/2024 in #questions
Export type to JSON and share it
So something that doesn't work with
JSON.stringify()
?119 replies
Aarktype
•Created by JameEnder on 4/12/2024 in #questions
Export type to JSON and share it
Non serializable
119 replies
Aarktype
•Created by JameEnder on 4/12/2024 in #questions
Export type to JSON and share it
What does "anything serialized" mean?
119 replies