Hacker News new | ask | show | jobs
by boubiyeah 3322 days ago
Yes, that would be its biggest differentiator.

Scala has it too indeed, but it's not the default mode and feels awkward, also has known limitations.

The nice thing with typescript is that structural typing makes sense for 90% of the use cases, and for the remaining 10%, you can very easily simulate nominal typing by adding a field like so:

interface Robot { __Robot: true }

1 comments

>interface Robot { __Robot: true }

I would much prefer if they just added a new keyword to the language, instead of hacks like this.

https://github.com/Microsoft/TypeScript/issues/202