Re:TypeScript: Branded Types
by kristiandupont on Friday April 26, 2024 @02:47AM
(#40166560)
>Function signatures already solve that problem.
I literally just showed you how they don't. And you even go on to describe a pattern that makes the problem "even less likely" in the next sentence..
>Branding seems like a solution looking for a problem.
You do you.
In fact, a common pattern is to pass fully-qualified objects, e.g. `dimensions = {width: number, height: number}`, which makes mixing up variables even less likely since you have to explicitly specify them.