lecongly
Typescript uses the same syntax as JavaScript with nifty additional features.
Typescript is just like JavaScript but has a strict syntactic structure with stringent datatype rules.
The type system in TypeScript, the set of rules on how to assign data types or types for short to variables, objects and other elements of my code is very stringent. Though JavaScript has type safety but TypeScript is stronger.
My favourite part of typescript is its ability to present hints while I code. When combined with powerful code editors like VS Code or WebStorm, the contextual code suggestions helped me reduce errors and increased my typing speed
Available separately the linter when enabled in the editor, can detect errors of syntactic, type and even contextual nature. It presents the errors by underlining the error part with red squiggly lines as I type. This makes error correction easier and faster.
What makes typescript versatile is its wide variety of configuration options. I can enable and disable different options to cater to my project’s needs.
One of the settings I used a lot is the target option. It flipped between commonJS module system and the es5 module system while learning.
As a beginner, all these strict rules felt time-consuming since it took less time to write the same in JS. Over time, I realized the usefulness of TS and started using its features as I learnt them. I’ve decided to use typescript in my next side project instead of JavaScript.