DEV Community

Cover image for Thoughts of Learning typescript for the past few weeks
Kamrul Haider Chowdhury
Kamrul Haider Chowdhury

Posted on

Thoughts of Learning typescript for the past few weeks

For the past few weeks, I have been learning Typescript. So, just to understand my learning I want to answer a question about typescripts.

What is typescript?

According to their website, “TypeScript is a strongly typed programming language that builds on JavaScript, giving you better tooling at any scale.”

Through my learning what I understand is that typescript is an extension of JavaScript. It helps you validate your variables and functions in a better way with faster implementation. Also with typescript, we can handle our errors faster and can detect them very easily. It increases our productivity by adding some additional syntax and by catching errors earlier by our editor.
It is JavaScript Code

In the above screenshot, we can see two-variable declared with the let keyword. later it was changed into different types as "a" to number and "b" to string. Which is completely okay in JS. But in typescript, you need to declare the types so that further changes of value can remain in the same type. Like below.

Typescript code

Although in typescript there are some syntax and methods that can convert a variable to multiple types.

Top comments (2)

Collapse
 
coderboyraiyan profile image
MD.Tajkier Haque Raiyan

Just wow 🔥🔥🔥🔥

Collapse
 
kamrulhaider profile image
Kamrul Haider Chowdhury

Thanks a lot mate :)