Hacker News new | ask | show | jobs
by jeppester 1023 days ago
In our team it's causing a lot of confusion an inconsistency that types and interfaces overlap 90% in functionality, but have different syntaxes.

You can find many articles trying to explain which is best under which circumstances, but there are no correct answers.

I would wish for TS to deprecate one of the syntaxes (probably interfaces because they read as statements rather than expressions), and instead extend the other with the 10% functionality that would be lost.

For instance a type could be declared as open, to make it possible to reopen and extend it.

1 comments

I even saw a Youtube video recently making a strong case that types are almost always the better option unless you run into a few niche use cases like needing interface merging.