Re:TypeScript: Branded Types
by spankalee on Wednesday April 24, 2024 @02:56PM
(#40148143)
The function is great in cases where you can validate the string, or paired with lint rules that limit casting.
[ Parent
| on HN ]
At that point I'd just use a class constructor.
That has a lot of overhead compared to validating and casting a primitive.
Does it though?