Re:A lightweight TypeScript library for assertion-based runt...
by nayajunimesh on Monday August 25, 2025 @02:33PM
(#45017258)
We actually use the idea of branded types in one of the validators (iso8601), and I also understand that it doesn't replace fully transformed values.
https://github.com/nimeshnayaju/valleys?tab=readme-ov-file#i...
Typescript language features like branded types, private constructors can make it so those values can only be constructed through the parse method.
They're really not much different, in terms of type safety*, from something like Serde.
*: they are of course different in other important ways -- like that Serde can flexibly work with all kinds of serialized formats.