- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to compile a Typescript file?
In this article are going to explore TypeScript and how to execute the same. TypeScript is an open-source programming language developed and maintained by Microsoft.
Setup for Typescript
You need to follow the below steps to work with typescript files −
Download & Install node.js and Node Package Manager(NPM).
Setup the NPM Environment variables for the typescript to work.
You can use the below command to check the Node & NPM version installed on your system.
For Node version
For NPM version
Note − We don’t need to explicitly install the NPM packages. Node will automatically download install NPM while downloading node.
Once the Node and NPM is installed, we need to install the Typescript on our system.
npm install -g typescript
In the below example, we have created a simple typescript file with 3 values i.e. greet, org, and tagLine. This file is in typescript. Now, we will use the below commands to compile this file into a JS file.
var greet : string = "Welcome to"; var org : string = "TutorialsPoint!"; var tagLine : string = "SIMPLY LEARNING!" console.log(greet+ " "+org ); console.log(tagLine);
var greet = "Welcome to"; var org = "TutorialsPoint!"; var tagLine = "SIMPLY LEARNING!"; console.log(greet + " " + org); console.log(tagLine);
The output of the above file on execution is shown below −
Welcome to TutorialsPoint! SIMPLY LEARNING!
- comp_err - Compile MySQL Error Message File
- How to compile a java program
- How to Compile a Lua Executable?
- How to compile packages in Java
- How to compile assert in Java?
- How to Edit, Compile, and Execute a C++ Program?
- How to compile unsafe code in C#?
- How to compile code using Arduino IDE
- How to compile & run a Java program using Command Prompt?
- How to compile and run the C++ program?
- How to compile embedded Lua code in C?
- How to compile a Python 3 app to an .exe using Tkinter?