Typescript in 5 minutes.
In this article we will simply write a small program in typescript . So if you are a newbie you can follow this program or you can start learning the typescript programming from this article as well.
We will do it steps by steps.
If you want to know about typescript please visit my blogpost https://whymysolutions.blogspot.com/2017/09/what-is-typescript.html
Step 1 :
To compile a typescript program we must need a typescript compiler and the compiler name is tsc compiler . You can get this in two ways
. By downloading the npm (by node.js package manager)
. By typescript's Visual studio plugins
By default Visual studio 2017 and Visual studio 2015 update 3 supports typescript .
Step 2 :
So for NPM users, to install the typescript
So now we will build our first typescript program. Create a file having name as "FirstProgram.ts".
Write down the below code .
So in command line run the following line
Step 3:
So when you compile the code then you will see a javascript file with same name as "FirstProgram.js" with same code.
Your output will be
So this our first typescript program . As it is a very simple one . We will discuss one by one in upcoming article.
If you want to know about typescript please visit my blogpost https://whymysolutions.blogspot.com/2017/09/what-is-typescript.html
We will do it steps by steps.
If you want to know about typescript please visit my blogpost https://whymysolutions.blogspot.com/2017/09/what-is-typescript.html
Step 1 :
To compile a typescript program we must need a typescript compiler and the compiler name is tsc compiler . You can get this in two ways
. By downloading the npm (by node.js package manager)
. By typescript's Visual studio plugins
By default Visual studio 2017 and Visual studio 2015 update 3 supports typescript .
Step 2 :
So for NPM users, to install the typescript
npm install -g typescript
Here g stands for globally . So after the complete of the installation we will write the program.So now we will build our first typescript program. Create a file having name as "FirstProgram.ts".
Write down the below code .
function FirstProgram(message) {
return "Hello, " + message;
}
let text = "Very good afternoon.";
document.body.innerHTML = FirstProgram(text);
return "Hello, " + message;
}
let text = "Very good afternoon.";
document.body.innerHTML = FirstProgram(text);
So in command line run the following line
tsc FirstProgram.ts
Step 3:
So when you compile the code then you will see a javascript file with same name as "FirstProgram.js" with same code.
Your output will be
Hello, Very good afternoon.
So this our first typescript program . As it is a very simple one . We will discuss one by one in upcoming article.
If you want to know about typescript please visit my blogpost https://whymysolutions.blogspot.com/2017/09/what-is-typescript.html
Comments
Post a Comment