Hacker News new | ask | show | jobs
by mason55 781 days ago
Not really, not for TS at least. If you just want to take a string and call it an email address and have your function only accept email addresses (the simplest use case) then you need to use branding. That's not encapsulation.
1 comments

Or double your GC burden by using a wrapper class.