News for hackers. Stuff that matters.
Re:TypeScript: Branded Types by shadowgovt on Wednesday April 24, 2024 @01:56PM (#40147603)
Probably not.

I could definitely see using something like this to force some constraints on my favorite bugbear for my problem domain: values that should have units. It matters a lot if "time" is nanoseconds, microseconds, or seconds, but most time-related functions just take in "number" like that's okay and won't cause thousand- or million-fold magnitude errors.

This is one way to provide some language safeguarding against treating 5 nanoseconds as the same as 5 microseconds.

There are no comments on this comment yet.