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.
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.
Although in typescript there are some syntax and methods that can convert a variable to multiple types.
Top comments (2)
Just wow 🔥🔥🔥🔥
Thanks a lot mate :)