First of all you need to install typescript, the way to do it is:
npm install typescript
After install typescript module, create a file with .ts file. In example, the name is HelloWorld.ts
.
Then, try to compile the file using tsc command.
tsc HelloWorld.ts
This command will create HelloWorld.js. After that run the .js files using node command
node HelloWorld.js