News for hackers. Stuff that matters.
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.
Re:TypeScript: Branded Types by cush on Wednesday April 24, 2024 @10:20PM (#40152599)
At that point I'd just use a class constructor.
Re:TypeScript: Branded Types by spankalee on Wednesday April 24, 2024 @10:37PM (#40152699)
That has a lot of overhead compared to validating and casting a primitive.
Re:TypeScript: Branded Types by cush on Thursday April 25, 2024 @02:41AM (#40154228)
Does it though?
Re:TypeScript: Branded Types by gliptic on Thursday April 25, 2024 @03:58AM (#40154727)
Yes.