News for hackers. Stuff that matters.
Re:TypeScript: Branded Types by dvt on Wednesday April 24, 2024 @06:03PM (#40150323)
> The primary point of branded types is to allow you to use the type system to ensure that a particular runtime check has taken place.

I see. This is kind of cool, though the branding can still be broken via down-the-stream mutations. Would be nice to enforce re-branding every time a variable is changed, but that seems like a lot of overhead.

Re:TypeScript: Branded Types by tshaddox on Wednesday April 24, 2024 @06:36PM (#40150699)
> the branding can still be broken via down-the-stream mutations

Only for mutable values! A branded string should be as immutable as they come, right?