Use Typescript in Large Project: Why Typescript

Shihao Xia
Nov 3 · 2 min read

More and more people are using Typescript/Node.js as their backend environment to deploy services.

There are several benefits:

Type

Type, type, type. Typescript brings Javascript most important thing is typing system. This is fundamental element in developing large project. With typing, IDE and compiler can detect lots of potential problem before runtime. Also it increases code readability so that reduces the maintenance cost.

Fast

  • Development Fast

Node.js is a Javascript runtime. Its overhead is small enough compared to JVM, quick enough because of event loop. This two feature indicates Node.js has fundamental elements of microservice development.

Node.js has a large community. Libraries and framework on NPM cover almost all you need. You don’t need to reinvent the wheel. Only thing you need is focusing on business logic.

  • Deploy Fast

Small runtime size and easy-to-use NPM (Dependency management tool) are born with cloud native application spirit. With the help of docker and kubernetes, building a high available microservice system is an easy thing.

  • Debug Fast

V8 engine/Node.js provides excellent debug experience. Lots of IDE like VS Code, JetBrains WebStorm provide nice visual way to debug application. You can easily set a breakpoint, view the stack, change the value at anytime anywhere.

  • Run Fast

Node.js is built on V8 (C++), a well-designed, written in C++’s engine. Async model is event loop, single thread. No switch context and fast enough to handle heavy I/O operation.

Consistency

  • Code sharing

Lots of types & interface, like error code, api client/interface can be share easily between frontend and backend.

Easy to Test

Mature community provides us many power testing tool to help us increasing the code and project quality. Mocha/Chai and other numerous libraries covers the usecases of unit test, integration test. With the help of docker compose, even complex testing setup can be easy to start with one command.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade