5 ms·
the two best features of Typescript's type system IMHO are: - structural typing for interfaces (which means that classes implicitly implement an interface if t
by zcrar70 13y ago
the two best features of Typescript's type system IMHO are:
- structural typing for interfaces (which means that classes implicitly implement an interface if the definitions match)
- gradual typing (mainly the ability to convert between 'any' and other types implicitly, which makes it much easier to interact with JS libraries/port JS code to Typescript.)
More generally speaking, Typescript aims to solve the problem of maintaining large codebases by giving you the additional security of static typing. The idea is that many simple errors can often be caught by a compiler, but would be much more time-consuming to find otherwise.
- tracker1 13y agoJS already has this.. if (obj && obj.quack && typeof obj.quack == 'function') obj.quack(); //looks like a duck