I was going to start a challenge by MLH: Local Hack Day, and the challenge was to write Hello World in a new programming language, and I thought I have never ever worked or even saw a code in TypeScript, so I started exploring and learning about it, and I literally got shocked and amazed how it works.
Don't judge, haha, I am a noob in TS.
And when I compiled the program, it created a new file with .js, as it should be. This was the most shocking, I really don't know why, because I have never seen such type of working in any other programming languages that I have used. It was cool.
I just started with TS, so created my first program.
TypeScript is an open-source programming language. It is developed by Microsoft.
- Purely object-oriented, with features like classes, objects, and interfaces like Java
- TypeScript supports other JS libraries
- Any valid .js file can be renamed to .ts and compiled with other TypeScript files
- TypeScript is portable
You can install tsc by running the following command:
npm install -g typescript
- Create a file named "helloworld.ts".
- Add these lines of code.
var greet: string = "Greetings"; var message: string = "MLH Local Hack Day!"; console.log(greet + " from " + message);
- To compile, run the following command:
Greetings from MLH Local Hack Day!
Hit a ❤, if you are also new to TS.