Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Sorry, with the Symbol? How does it work?


You don't even need the symbol. If you want the simplest thing that will work:

    type Velocity = number & { BRAND: "Velocity" }
    type Distance = number & { BRAND: "Distance" }

    var x = 100 as Distance




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: