#object-oriented programming

TS is a superset of JS with the difference that browsers don’t know how to run TS code, so you need a compiler to transfer the TS code to regular JS. This means that looking from the bundled code, both React JS and React TS bundle the same JS code, hence, no difference in the end.

TS is an object-oriented programming language (JS is a scripting language). Some additional things that TS gives support for modules and it has interfaces (JS doesn’t have interfaces) and types to describe data being used. TS also supports static typing, meaning it permits checking type accuracy at compile time. It highlights the compilation error at the time of the development, so you easily and early detect errors (fewer runtime errors which can be awful with JS).

The coins can be the learning curve depending on your previous experience & also that the compilation time can take some extra time since the source code building has to go through another layer of transpiring.

So, yeah TS is worth it if you have some previous experience in object-oriented programming (or are willing to learn) and have a bigger coding project, but for smaller projects, JS is ideal.

Subscribe to #object-oriented programming