Regardless of this key distinction from JavaScript, TypeScript can nonetheless be executed anyplace JavaScript can run. That’s as a result of TypeScript compiles to not a binary executable, however to straightforward JavaScript.
TypeScript vs. JavaScript
TypeScript is a superset of JavaScript. Whereas any appropriate JavaScript code can also be appropriate TypeScript code, TypeScript additionally has language options that aren’t a part of JavaScript. Probably the most distinguished characteristic distinctive to TypeScript—the one which gave TypeScript its identify—is, as famous, robust typing: a TypeScript variable is related to a sort, like a string, quantity, or boolean, that tells the compiler what sort of information it may maintain. As well as, TypeScript helps sort inference, and features a catch-all any sort, which implies that variables don’t should have their varieties assigned explicitly by the programmer.
TypeScript can also be designed for object-oriented programming, whereas JavaScript isn’t. Ideas like inheritance and entry management that aren’t intuitive in JavaScript are straightforward to implement in TypeScript. As well as, TypeScript lets you implement interfaces, a largely meaningless idea within the JavaScript world.
