hero image of blog post - Web development: TypeScript - pros & cons
Authors
Stanislav Naborshchikov
Stanislav Naborshchikov

Channel Marketing Manager

Mateusz Tkacz
Mateusz Tkacz

Backend & DevOps Tech Leader

Irek Róg
Irek Róg

Frontend & Mobile Tech

Web development: TypeScript - pros & cons

Today, there are many programming languages that web specialists use to create online projects all over the world. Each of the languages has its own advantages and opportunities for the development of original sites, in addition, the convenience of using a particular language when writing high-quality code plays an important role. In this article for MRBlog, we will consider all the features and characteristics of the TypeScript language, which was developed by the world-famous Microsoft company. The language specifications are open and published under the Open Web Foundation Specification Agreement.

Among the main features of the TypeScript language , we highlight the following:

  • the TypeScript language is strongly typed;

  • TypeScript code can be compiled into JavaScript;

The language is backward compatible with JavaScript and even if the developer writes mixed code, it will also be valid.

TypeScript opens up many opportunities for web professionals. First of all, the technology for working with. You can also inherit interfaces (including multiple inheritance), classes. You can describe your own data types and create generic interfaces. You can also describe the type of variable (or object properties), or describe what interface the object referenced by the variable should have. And, if necessary, describe the signature of the method.

TypeScript was created for large and cumbersome projects that are developed by a team of developers, not individual programmers. Therefore, this language is distinguished by developed development tools, components and the collection of the final project from the file structure, which is largely branched.

What are the advantages of TypeScript in development?

  • using ECMAScript, which allows the code to work without converting classes;

  • TS is greatly integrated with multiple IDE's like xxxx. This makes developers live easier through auto-completion functionality. It also helps with refactoring and debugging by type checking during compile time.

  • TypeScript can be used on the client or server side in Node.js as in the end it is compiled into plain JavaScript.

It's worth trying to work with TypeScript for many reasons. Among which:

  • The ability to rigidly describe each element of the application. A web specialist needs to clearly think through the logic of the application up to the moment of implementation. There is no way to change one part of the project, while breaking the other part.

  • It is possible to describe the scope of class properties.

  • You need to write fewer tests because of the rigid architecture.

  • Some of the code formatting errors are excluded due to the rigid format of programming language constructs.

In addition to all the above advantages of developing applications in TypeScript, a web specialist will need a lot of time when compared with JavaScript development, because in this case it is necessary to describe all the interfaces involved, method signatures. Thanks to TS we will lose less time on debugging compared to JS. It will even decrease development time in large applications.

In addition, Microsoft's development is encouraging for long-term support and further fruitful development. In this case, it is worth getting acquainted with this language in more detail and studying it in as much detail as possible.

TypeScript is a special add-on over JavaScript. With the help of the first one, you can perform many functions: use already written JavaScript code, include popular libraries, call TypeScript code that is generated from other JavaScript.

Everyone can get acquainted with the TypeScript source code on the github resource. This language has great prospects for development in the near future, and already provides many opportunities to work with Javascript. It is also important to note that TypeScrip will be easier to learn for web professionals who have previously worked with C#, Java and other languages with classic OOP syntax.

In addition to all the advantages we’ve written above, Typescript also has some disadvantages:

  • A significant slowdown in the build of the project. But this, again, is exclusively in our build specifics: Webpack + TS + Babel. Who has the same configuration (+- babel), I can advise you to use the ts-loader loader with the transpileOnly flag, and run TSC in parallel. And in the incremental build mode (--watch), keep 2 processes separate: webpack --watch and tsc --watch.

  • There are also some problems with NodeJS OutOfMemory errors, such surprises are especially unpleasant when you need to build a project and release a release in 3-4 days, but you can't solve them quickly.

The need to update versions .d.ts for external libraries. Thank God, it's over with tsd > typings. And now everything can be downloaded immediately via npm > @types. What if a new version of the library has been released, lodash for example, and .d.ts is not yet available? Then you have to choose: add it yourself (to the repository or put it on github in the DefinitelyTyped repository) or not use this feature yet.

Search for developers with TypeScript experience. These are individual tears for HR. As far as we know, everyone on the market now has a problem finding “advanced” frontend developers with experience writing serious SPA, Angular|React|Vue, Typescript, Redux, etc.

Conclusion

If you're new to JavaScript, you shouldn't grin at the first mention of TypeScript. TypeScript was developed not just to encourage back-end developers to work with front-end, but to provide everyone with a tool that allows them to create reliable code based on lessons learned from other languages.

JavaScript was created to be portable and simple — but over time we saw that the language went beyond its original intent. Although several hundred, if not thousands of lines of code could still be supported in regular JavaScript — we all know that this is no longer the case. JavaScript code works everywhere and on almost every device. The number of rows is growing exponentially, and we need a way to mentally digest and maintain it.

It is not difficult to study TypeScript itself. It is written and works like JavaScript — with only a few tools and techniques that will help you improve the code. In fact, you can just write TypeScript code like JavaScript and it will compile anyway. Although TypeScript may seem like syntactic sugar, it makes our experience of supporting and writing code much more optimal.

Matt Sadowski / CEO of Mobile Reality
Has this article been helpful? Are you interested in consulting your business initiative with us? We would be thrilled to support your tech and business efforts in order to create profitable digital products with you! Just contact us through the contact form or chat on our website our experts are always ready to advise you and help you create an effective mobile or/and web platform for business.

Check also

Back to blog