Hey, thanks for the article!
I've got a thing to mention on point 1 which reads "Interfaces are extendable - types are not".
You say:
If, after its been defined, I suddenly realise I want to add an address too, I will need to change the original type declaration. With interfaces, we can declare something new, and extend user
Actually, with types you can do pretty much the same using an Intersection Type with &.
The result is pretty much the same as with interfaces. The only difference is (as also explained in the doc) on conflicts, but as long as all fields are different, you can extend types with other types :)
hey, that's a good point that I forgot about. Let me update the article. I've also updated to include the info on conflicts which is quite interesting (and something I didn't know about before, actually).
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hey, thanks for the article!
I've got a thing to mention on point 1 which reads "Interfaces are extendable - types are not".
You say:
Actually, with types you can do pretty much the same using an Intersection Type with
&
.The result is pretty much the same as with interfaces. The only difference is (as also explained in the doc) on conflicts, but as long as all fields are different, you can extend types with other types :)
hey, that's a good point that I forgot about. Let me update the article. I've also updated to include the info on conflicts which is quite interesting (and something I didn't know about before, actually).