Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
April 14, 2022 11:40 am GMT

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.


Original Link: https://dev.to/kamrulhaider/thoughts-of-learning-typescript-for-the-past-few-weeks-3966

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To