Typescript and React

Typescript Pros…

Interfaces- makes code predictable because we define what type of data our component or function will be working with. Javascript like many other languages has a few different types of data. However it differs from many other languages in that it doesn’t get picky about declaring those types. If you’re familiar with Java then you’ve already had to declare if your block was going to be a string, number etc. Typescript applies these same declarative rules to help maintain and organize your code.

Editor Support- Inteleseness or autocomplete is a nice little perk of typescript. it comes with plenty of shortcuts and and intuitive guessing on what labels you might give functions.

Static Type Checking- Another perk to the actual typescript environment is that you don’t have to wait until you compile to get all your errors. Typescript errors will be underlined right away.

Universally compatible- with any browser. Typescript takes care of compiling your code to be universally read by any window regardless of which ECMA script it’s compatible with.

Typescript Cons…

Learning Curve- There is definitely some getting use to with typescript.

To Lofty for Little Projects- as typescript takes a little more initial boiler plate setup and extra work and time compiling tsx files, it may be unnecessary for very small projects.

Misleading Clean code- occasionally for a variety of reasons it may miss mistakes in the code for various reasons. This means you can’t entirely lean upon typescript all the time to catch mistakes before compiling. Like any language or framework it’s good to stop often and make sure your code is still working.

Full Stack developer — Passionate about simplifying concepts, design, and innovation.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store