We're finally at the TypeScript installation stage. Now that we have all of the dependencies installed, TypeScript installation is a piece of cake through npm:
$ npm install -g typescript
And that's it. TypeScript is ready to be used.
To create our first TypeScript application, create a folder called my-first-ts-app and in this folder, create a file called hello.ts with the following content:
function hello(person) {
return "Hello, " + person;
}
let user = "John User";
document.body.innerHTML = hello(user);
As you can see, it used a .ts extension for the hello.ts file, which means that this code is just JavaScript.
Now, it is time to compile the hello.ts file by running the following command at the command line:
$ tsc hello.ts
The result has to be a file called hello.js, which contains the same JavaScript that you filled in...