The goal of this chapter is to get you started with the TypeScript development. We’ll start with paying respect to JavaScript, and then will share with you our own opinion on why you should be programming in TypeScript. Then we’ll compile and run the very basic programs so you understand the workflow from writing the program in TypeScript to compiling it into runnable JavaScript.
This chapter covers:
- The benefits of programming in TypeScript over JavaScript
- How to compile the TypeScript code into JavaScript
- How to work the Visual Studio Code editor
In this book, we’ll be programming in TypeScript, but to run the code, we’ll need to compile the code to JavaScript, so let’s go back in time and do a quick review of this language.
In May of 1995, after 10 days of hard work, Brendan Eich had created the JavaScript programming language. This scripting language didn’t need a compiler and was meant to be used in the web browser Netscape Navigator.
No compilers were needed for deploying a program written in JavaScript in the browser. Adding a <script> tag with the JavaScript sources (or a reference to the file with sources) would instruct the browser to load and parse the code and execute it in the browser’s JavaScript engine. People enjoyed the simplicity of the language - no need to declare types of variables, no need to use any tools - just write your code in a plain text editor and use it in a web page.