Reason to learn TypeScript?
You can install it by running the following command.
npm install -g typescript
Let’s understand the working of the code using an example.
Example: In this example, we are creating a basic example that will print “Greetings from GeeksforGeeks”.
// Save the file as index.ts var greet: string = "Greetings"; var geeks: string = "GeeksforGeeks"; console.log(greet + " from " + geeks);
Step to compile: To compile the code, we can run the following command on the command line.
Greetings from GeeksforGeeks
P.S: To continue this tutorial go along with an organized left bar, that will help you to understand this tutorial in a better way.
Learn more about TypeScript:
- How to install TypeScript?
- Hello World in TypeScript
Please write comments if you find anything incorrect, or if you want to share more information about the topic discussed above.