Introduction to Typescript

Somewhere around 2014, I was given a responsibility to migrate an existing Flex based application to HTML 5. Indeed this was needed for one of our flagship product. Flex days were over and to remain competitive in the market, the migration process was very critical. While we reached a conclusion of selecting UI frameworks (partially based on the experience of another group), I was a bit skeptical about using JavaScript for this huge project. The reason for my confusion was primarily because of its dynamic type nature. Things tend to get ugly soon with the rise in project size. I stumbled upon two more options with a little bit of a research – Typescript, and CoffeeScript.

Deja Vu

I never coded earlier in Coffescript or Typescript. It is just on a few occasions that I came across the code written in both these languages – First while surfing Github projects and second when my daily habits of visiting StackOverflow. Apart from that, the world of these languages was alien to me. I naturally had to start unearthing information so that I can choose the correct language for development. I felt pretty confident after realizing that Typescript was actually authored by Microsoft and they were continuously making the improvements.

Typescript felt bit natural and friendlier. The syntax seemed similar to Javascript and other Object Oriented languages that I knew at that time.

I got more interested in considering Typescript as a strong candidate for the development. But before I could finalize my decision, I had to do few exercises – Consult with experts in the company about the choice and Second work on a Proof Of Concept (POC). The later exercise was required to understand the ecosystem, learning curve and support for the libraries, we have chosen for UI development.

Typescript illustration :)

It looks colorful 🙂

Decision

Discussion with experts turned out to be opposite of what I had in my mind.  The emphasis was on choosing CoffeeScript. I was not satisfied with the answers and I felt I should still go ahead and explore Typescript. Given the number of people I was dealing with on daily basis (which I now feel as an excuse, I am literally bad in time management), I thought of assigning Typescript evaluation to a new programmer. The output of POC didn’t turn out that good and the initial impression was – a lot of problems in choosing Typescript as a mainstream language for development. Unfortunately, the rising pressure to kickstart the development and finish it before certain date lead to a decision of not using Typescript (which I definitely regret primarily because of my limitation to push things). We kickstarted the project with Javascript and continued to develop with it.

It was quite evident that the rise of Javascript based frameworks was almost taking the industry by storm.

While we went ahead with Javascript, somewhere in my mind I felt a strong urge to explore Typescript. Doing large scale developments in Javascript was/is really painful. To give you an example – very few people understand how scope actually works in Javascript and then there is closure, prototypes, binding, modules etc. I felt Typescript is definitely an answer to that.

A, B, C of Typescript

There was a lot of struggle to get started with it. The absence of tutorials and documentation proved to be far more complex to pick up the concepts. But after working on a few hobby projects and scanning through the Open Source material, I finally got a hang of the language. I realized that coding into Typescript is much easier than Javascript. In fact, dealing with closures and simulating OOPS nomenclature is far friendlier than tweaks that need to be applied in Javascript. Unfortunately, we couldn’t adopt Typescript into mainstream development because of sheer code size that we had developed by that time.

Typescript my first choice

Recently while dealing with the confusion of selecting an appropriate topic for my first Video Course, I somehow decided to give a try on Typescript. There was a confusion regarding what is the right way of coding in it. And this finally led to a decision of building a Course.

I realized that my early days of learning Typescript was not that great – I literally struggled in setting up Typescript configuration and tools in the IDE.

The video series begins with basic fundamental requirements of Typescript. Right from configuring dependencies like NodeJS, Typescript transpiler and my favorite IDE – VS Code. Well, we quickly jump to our very first program of printing Hello World. The steps will make you familiar about how to configure (in fact zero custom configuration) Typescript project and compiling the project.

With not so complex setup of Typescript, the series then focus on implementing one of the main features of OOPS – Inheritance. OOPS primarily helps to build modular code with low coupling. Identification and well-defined Objects definitely increase the flexibility in the project and avoids clutter. The second video will make you familiar with how Inheritance in Typescript can be implemented.

As soon as the project size grows, it is necessary to optimize certain development processes. In fact, Typescript was primarily born out the same thought. Compiling the entire project for every change will definitely have an adverse impact on developer productivity. The creators of Typescript addressed this problem by introducing watch mode.

The series is still in progress and new videos are on their way. Make sure you subscribe to my YouTube channel and click the ring icon to get notification of new videos. Feel free to comment and post your views on the channel.

Be Sociable, Share!

1 Comments

  1. Hi Yogesh, I really like the way you simplify the concepts and explain it .Liked it. All the best and will be actively following you.

    Reply

Leave a Comment.