Tag Archives: javascript

TypeScript vs JavaScript

TypeScript is JavaScript with types, to put it simple.

  • How do I install?
    • npm i -D typescript
  • Does it work on Linux/Mac?
    • Yes
  • Does my editor support it?
  • Do I have to learn a whole new language? Like CoffeeScript, Dart…?
    • No! Absolutely no!┬áIf you know JavaScript you know 95%. The remaining 5% or less is basically configuration.
  • Any big companies using it?
  • Does it support React?
    • Yes. `.tsx` files.
  • Have you ever coded a real project with it?
    • Yes and I actually kept it compatible with the architecture of other (js) projects in my company. One of the projects is scaling.
  • How many bugs did you prevent?
    • Over 9000… A lot and very recently I found a bug in production in a very big project that would never happen if it was coded in TypeScript.
  • Do you still use babel?
    • Not if I get to choose which version of node I will be using. For some old versions some polyfills are really good… TypeScript does not add polyfills, it does not change your code more than enough to support a few ES features. You can check it out for yourself on TypeScript playground, the playground targets ES3, so if you use arrow functions or async/await TypeScript will “alter” your code.

Continue reading