This is the continuation from the last segment. In this case, we will first gets started with Visual Studio Tooling support for Typescript. In order to download the same, you need to download from http://www.typescriptlang.org/#Download. Once you open the page, you will see the download options as shown below.
Then, I will switch to Visual Studio and create new web application as shown below.
Then, I will select empty template as shown below
Here, I have added one Scripts folder as shown below in the solution explorer.
Now, when I rt-click the Scripts folder, it will show TypeScript options as shown below.
After, clicking OK, it will prompt the following message.
I will say yes and proceed, then it will open the blank TS file. Also, if you look at the solution explorer, it will show you the newly added file.
However, one point to note here, after saving the same corresponding JS file is not getting generated. Reason for the same is, default tooling option to compile on save in not checked as shown below in the screenshot.
Upon enabling the same,
It will produce the auto-generated JS file as shown below. By default, It won’t be part of project. So, you need to do showall files in explorer, then it will show all the files.
Now, if open the JS file, it would have produced the following snippet.
Now, let us go ahead and add one HTML file just reference the JS file in the same.
With the above change in place, it will show the following output.
I hope you would have liked this discussion. Thanks for Joining me. In coming section, we’ll delve more. Till then, stay tuned and Happy Coding.
Code Download Link:- https://github.com/rahulsahay19/TypeScript-Demo
2,201 total views, 1 views today