How are JavaScript and TypeScript related?


1 min read

TypeScript is a typed superset of JavaScript and, when compiled (or transpiled), emits pure JavaScript.

What's that mean?

  • If there are no syntatic errors in your JS, it is valid TS
  • Migrating existing codebases can be done piece by piece
  • All JavaScript is TypeScript but not all TypeScript is JavaScript

All this means that you can (like I am) gradually learn TS and gradually add it to more of your projects. The typing will hopefully catch errors sooner - at compile time rather than run time - but it won't necessarily catch every problem.