05/10/2026 10:04am

What Is TypeScript? TypeScript vs JavaScript and When to Start
#what is TypeScript
#TypeScript vs JavaScript
#difference between TypeScript and JavaScript
#should I learn TypeScript
#React TypeScript
#TypeScript interface
#type checking
A few months into JavaScript, most students feel pulled two ways. Every job post they open mentions TypeScript, yet their JavaScript still feels too shaky to take on something new. Which pull should win depends on how comfortable you are with JavaScript right now, because TypeScript is not a new language you start from zero. It is JavaScript with an extra reviewer looking over your shoulder.
The easiest way to see what that reviewer does is to watch it catch a real bug. Today Superdev Academy walks through one small bug that JavaScript happily runs and TypeScript catches before anything runs, then gives a straight answer on when a beginner should start TypeScript, and what it does not protect you from.
A small bug JavaScript lets through
Imagine a points page. A user has 100 points and types a bonus of 50 into an input field. We write a function to add them up:
// points.js
function addPoints(current, bonus) {
return current + bonus;
}
const bonus = document.querySelector("#bonus").value; // "50", a string
console.log(addPoints(100, bonus)); // 10050
The answer should be 150. What comes out is 10050, because a value read from an input field is always a string. When you add a number to a string, JavaScript does not complain. It quietly glues the two together as text. The program finishes, and not a single error appears.
What makes this kind of bug dangerous is how quiet it is. You find out when someone sees a five-digit points balance on screen, and that someone might already be a real user.
TypeScript catches the same bug before it runs
Now write the same function in TypeScript. The only addition is : number in two places, telling TypeScript that both parameters must be numbers.
// points.ts
function addPoints(current: number, bonus: number): number {
return current + bonus;
}
const bonus = "50";
addPoints(100, bonus);
// Error: Argument of type 'string' is not assignable to parameter of type 'number'.
The last line is flagged immediately, before you have even opened a browser. In VS Code you see a red underline under bonus as you type (if your editor is not set up yet, see VS Code: The Most Popular Editor for Developers and Why You Should Use It). The fix is simple: convert the value to a number first, for example addPoints(100, Number(bonus)).
Put simply: JavaScript finds this bug at runtime. TypeScript finds it before runtime. Every other difference between the two starts here.
So what is TypeScript, exactly?
The official TypeScript website describes it in one line: "JavaScript with syntax for types." TypeScript is developed by Microsoft and is open source. Almost any valid JavaScript can go straight into a TypeScript file, and you add types gradually from there.
At its core is type checking, and it is static: TypeScript reads your code without running it. The tool that does this is tsc, the TypeScript compiler, and it does two jobs at once:
Checks types: finds places where the wrong kind of data is used and reports an error.
Compiles to JavaScript: strips out every type annotation and outputs a plain
.jsfile.
The second job matters more than most beginners realise. Browsers cannot run TypeScript directly, so what actually runs on a user's machine is the JavaScript that comes out the other end. The official TypeScript Handbook says it plainly: type annotations never change the runtime behavior of your program. Keep that sentence in mind, because it comes back in the limitations section below.
TypeScript vs JavaScript at a glance
What we compare | JavaScript | TypeScript |
|---|---|---|
When type errors are found | At runtime | Before runtime |
File extension | .js | .ts |
Needs compiling first? | No | Yes, to run in a browser (Node.js from 22.18/23.6 runs .ts files directly for erasable type syntax only, Deno and Bun run them directly too, but none of them type-check by default) |
Type annotations | None | Yes, e.g. |
What the browser runs | The .js file | The compiled .js file |
If you have read about how JavaScript was created in 10 days, it is easier to see why JavaScript is so relaxed about data types. It was designed for short scripts on web pages, not for teams of dozens maintaining hundreds of thousands of lines. TypeScript fills that gap without changing the language that actually runs.
Why TypeScript seems to be everywhere lately
It is not just a feeling. Two primary sources back it up:
GitHub Octoverse 2025 (published 28 October 2025) reported that August 2025 was the first time TypeScript became the most used language on GitHub by contributor count, passing Python by roughly 42,000 contributors.
The Stack Overflow Developer Survey 2025 found that 43.6% of all respondents worked with TypeScript in the past year (JavaScript sits at 66%). Among professional developers the TypeScript figure rises to 48.8%, while among people learning to code it is 31.9%.
Both sources are global. Neither measures developers in any single country, so they show the direction of the industry rather than the share of any one local job market. What the numbers do show is a fairly wide gap between learners (31.9%) and working developers (48.8%), which suggests many people first meet TypeScript at their first job, not while studying.
One more recent change: TypeScript 7.0 shipped as a stable release on 8 July 2026. The TypeScript team rewrote the compiler as a native port in Go and reported full builds running roughly 8 to 12 times faster. The command is still tsc. For a beginner this barely changes how you write code, but it is a signal that the tool is still being invested in heavily.
TypeScript is not free, and it does not stop every bug
By now TypeScript may sound like it has no downside. It has two real costs worth knowing before you decide.
Setup and learning cost. A .js file opens in the browser as it is. A .ts file needs TypeScript installed with npm install -D typescript, a tsconfig.json config file, and an extra compile step. On top of that, some error messages run several lines long and are hard for a beginner to read. If you are still unsure how variables and functions work, adding a layer of type errors can wear you down faster than it should.
The bigger one: types do not check data at runtime. Remember the Handbook line above? Types are erased at compile time. Once the program is running, nothing checks types anymore. The most common place this bites is data from an API:
interface User {
name: string;
age: number;
}
const res = await fetch("/api/user");
const user: User = await res.json();
console.log(user.age + 1); // if the API sends age as "20", this prints "201"
This code passes type checking without a complaint, because we told TypeScript "trust me, this is a User." But if the server sends age as a string, the exact bug from the start of this article is back, and this time TypeScript cannot see it at all. (If sending and receiving data through an API is still new to you, start with What is an API?)
So data that comes from outside your program, whether from an API, an input field or a file, still has to be checked at runtime, for example with typeof user.age === "number" before you do any maths with it. TypeScript keeps the code inside your program consistent with itself. It cannot make the outside world send you what you expect.
When should a beginner start TypeScript?
The straight answer: after you can write basic JavaScript, not before, and without waiting until you feel like an expert.
The reason is that everything TypeScript checks is JavaScript. If you do not yet understand how a string differs from a number, or what an object looks like, TypeScript errors are just noise, not help.
Signs you are ready to move to TypeScript:
You can write functions and use arrays and objects without looking up an example every time.
You have used
fetchand handledasync/awaitin at least one project.You keep running into "wrong kind of value" bugs, or
undefinedshowing up from nowhere.You are about to start a React project, or your workplace code is already in .ts files.
The lightest way to start is to take a small JavaScript project you already have, rename one file from .js to .ts, and add types to the function parameters first. Seeing what TypeScript flags in code you wrote yourself teaches more than a whole chapter of theory.
The interface keyword in the API example above is simply a way to name the shape of an object so you can reuse it. A React project written in TypeScript works on the same idea: files become .tsx and types describe each component's props. If the points bug at the start made sense to you, you already understand why both exist.
If you are still deciding which language to learn first, it helps to hear how others chose theirs and whether they would choose the same again: What Was Your First Programming Language?
Summary: what TypeScript is, and when to start
TypeScript is JavaScript with types added. Its checker, tsc, looks for data-type bugs before your code runs, then compiles everything down to plain JavaScript for the browser. The key difference fits in one line: JavaScript finds a bug like 100 + "50" at runtime, TypeScript finds it before runtime. The price is extra setup, and one thing to always remember: types do not check data coming from an API at runtime.
If basic JavaScript still feels shaky, there is no rush. Build that foundation first. If you can already write functions and fetch data, rename your first file to .ts this week and see what TypeScript finds in your code.
Follow more articles and tips for people starting out as programmers on our channels.
Facebook: Superdev School (Superdev) — https://www.facebook.com/superdev.school.th
Instagram: superdevschool — https://www.instagram.com/superdevschool/
TikTok: superdevschool — https://www.tiktok.com/@superdevschool
Website: www.superdevacademy.com — https://www.superdevacademy.com/
FAQ: Frequently Asked Questions about This Article
A collection of questions and answers to help you better understand the content of this article.