Answer the question
In order to leave comments, you need to log in
Should you use type or interface?
As far as I understand, in the latest versions of ts type, an alias can do everything the same as an interface, with the exception of declaration merging.
Does this mean that if declaration merging is not required, then it is better to always use types, not interfaces, so that the code looks more uniform, or are there other thoughts on this?
Answer the question
In order to leave comments, you need to log in
Should you use type or interface?
it's better to always use types, not interfaces, so that the code looks more uniform
Thoughts are simple in fact: look to the root.
Use interfaces to describe interfaces, use types to describe types.
And no, it's not the same thing.
To exaggerate: an interface is a description of a data structure that occurs at the junction of the interaction of system components or different systems, is mainly used only at this very junction; type - these are the internal entities that the system operates on and which are found everywhere.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question