With the use of SWC in your project

TypeScript became a standard for backend (Node.js) and frontend (Angular/React) development. The types it brings allow us to develop apps with the confidence that we won’t make any silly mistakes. It doesn’t relieve us from the responsibility of using best coding practices, but it does make developers’ lives a bit easier.

Yet, there is one downside of TypeScript. It’s compile time. So, let’s talk about how to speed up your TypeScript project.


The more code you have, the longer it takes to compile. I think we can all agree on that. In some cases, that’s also the reason why we split the application into smaller pieces (services), so we don’t need to compile everything.

This includes:

  • production-ready containerization,
  • TypeScript support,
  • Plop for code generation,
  • built-in support for Redis and PostgreSQL with TypeORM,
  • best practices like Command pattern or Dependency Injection with  Awilix,
  • REST/graphQL API support

…and more!

In its raw form, running the npm run watch command (which starts the TypeScript Compiler - tsc - in a watch mode) takes 28 seconds to have an environment ready to work with.

It doesn’t sound like a lot, but with more code to come, this number will slowly increase. So what happens during compilation?

In short, there are two major components:

  • types checking,
  • transpilation to JavaScript

At this point we cannot do much with the first one, however, there is a way to speed up the transpilation part.

TypeScript itself can’t change TypeScript code into JavaScript files. There is no such functionality. However, there is one that allows us to check types only — noEmit flag.

So, what if we use something faster for a transpilation part and use tsc only for TypeScript types checking?

#ui #programming #typescript #javascript

How to Speed Up Your TypeScript Project
1.45 GEEK