asd

asd

asd
8 min read

For years, JavaScript has been the primary language for web development. Nearly every modern website uses JavaScript, from the frontend to the backend using Node.js.

However, in recent years, a new trend has emerged. Many developers, from startups to large companies, are starting to switch to TypeScript .

Modern frameworks like React, NextJS, Angular, NestJS, and even many new Node.js projects are starting to use TypeScript as a standard.

So why has TypeScript become so popular?


What is TypeScript?

TypeScript is a programming language developed by Microsoft.

Simply:

TypeScript = JavaScript + Static Typing

This means that TypeScript retains JavaScript syntax, but adds a stricter data type system.

Typical JavaScript example:

let total = 100;

total = "seratus";

The above code does not produce any error.

But in TypeScript:

let total:number = 100;

total = "seratus";

Results:

Type 'string' is not assignable to type 'number'

Errors appear faster before the application is run.


JavaScript Issues As Projects Grow

JavaScript is very flexible.

But this flexibility sometimes becomes a problem when:

  • The developer team is growing
  • Files reach hundreds
  • APIs are increasing
  • The project has been going on for years.

Example:

function calculate(data){
    return data.price * data.qty;
}

We don't know:

  • Is it pricealways numbers?
  • Is qtythere any?
  • Is the data empty?

On small projects it may be safe.

But on large systems, bugs like this often appear.


Benefits of Using TypeScript

1. Errors are found faster

TypeScript performs checks before the application is run.

Example:

function total( price:number, qty:number){
    return price*qty;
}

total("100",5);

The editor immediately gave a warning.

This helps reduce bugs.


2. Easier for the Team to Understand

The code becomes clearer.

Example:

type Product={
    name:string;
    price:number;
    stock:number;
}

Other developers immediately understand the data structure.


3. Suitable for Large Projects

TypeScript is very helpful for:

  • ERP
  • Dashboard
  • SaaS
  • Internal system
  • complex API
  • Enterprise applications

Because the type documentation is integrated with the code.


4. Better Editor Support

Editors such as:

  • VS Code
  • Cursor
  • Bring

Give:

  • Auto completion
  • Type hint
  • Refactor
  • Error detection

Coding experience becomes more comfortable.


5. Many Modern Frameworks Use It

Sample framework:

  • Angular
  • NextJS
  • NestJS
  • Nuxt
  • Ionic

Some even make TypeScript their primary choice.


Comparison of JavaScript and TypeScript

Feature JavaScript TypeScript
Static typing No Of
Error before runtime Limited Of
Data documentation Manual Automatic
Suitable for large projects Currently Very suitable
Learning curve Easy A little higher

Simple Example of JavaScript vs TypeScript

JavaScript

function greeting(name){
    return "Halo "+name;
}

console.log(greeting(10));

Output:

Halo 10

There are no errors.


TypeScript

function greeting(name:string):string{
    return "Halo "+name;
}

console.log(greeting(10));

The editor will reject:

Argument of type number
is not assignable
to parameter string

Simple TypeScript Project Example

File:

app.ts

interface User{
    name:string;
    age:number;
}

const user:User={ name:"Andi", age:25 };

function showUser(data:User){
    return ` Nama: ${data.name} Usia: ${data.age}`;
}

console.log(showUser(user));

Compile:

tsc app.ts

Run:

node app.js

Output:

Nama:
Andi

Usia:
25

This example is simple but already shows the benefits of data types.


Is JavaScript Going Away?

No.

TypeScript actually still uses JavaScript.

During build:

TypeScript
↓

Compile
↓

JavaScript

The browser still runs JavaScript.

So TypeScript is not a total replacement, but rather an additional layer.


When Should You Use TypeScript?

Use JavaScript if:

  • Rapid prototyping
  • Landing page
  • Small script
  • Experiment

Use TypeScript if:

  • Big team
  • Many APIs
  • SaaS
  • Dashboard complex
  • Enterprise systems
  • Long-term project

Conclusion

Many developers are starting to switch to TypeScript not because JavaScript is bad.

The reasons are:

  • Reduce bugs
  • Clearer structure
  • Supporting big teams
  • Simplify maintenance
  • Suitable for modern projects

It's therefore no surprise that TypeScript is increasingly appearing in today's application development stacks

Recommended for you