How a Website Helps a Small Business Find Customers on Google
A customer types a question, Google shows a few results, and whether your website is among them comes down to three steps: Google finds the…

What is TypeScript? That is the question many people ask after writing JavaScript for a while and hitting a bug they cannot explain. Suppose you build a website for a small shop. The page adds the price of an item to the delivery fee, then shows the total to the customer. One day, the total shows as 12000015000 instead of 135000. No error appears, no warning shows up. The page still runs, only the number is wrong.
The bug sits in a tiny place: the delivery fee arrives in the code as a text string, not as a number. JavaScript adds a number to a string by joining them into one longer string. It reports no error, because for JavaScript that is valid behavior. TypeScript exists to catch exactly this kind of bug, before the code runs.
Quick summary
- What is TypeScript, in short: JavaScript plus static types. You state whether each value is a number, a string, or something else, and the compiler checks it before the code runs.
- JavaScript reports no error when you add a number to a string or mistype a property name. TypeScript reports both errors at compile time.
- TypeScript is a superset of JavaScript: every valid JavaScript program is also a valid TypeScript program.
- TypeScript 7, released on 8 July 2026, rewrites the compiler in Go and usually runs 8 to 12 times faster than TypeScript 6.
TypeScript is JavaScript plus a static type system. You write JavaScript as usual, then add notes saying what type each value has: this is a number, this is a string, this is an object with these properties. The TypeScript compiler, called tsc, reads those notes and checks whether the code uses any type the wrong way. When the check is done, it erases the type notes and produces plain JavaScript for the browser or Node.js to run.
According to the official TypeScript documentation, TypeScript is a static type checker. Static checking means finding errors without running the code. It decides what counts as an error based on the kinds of values being used. TypeScript is JavaScript plus a compile-time type checker.
TypeScript grew out of the need to build large applications in JavaScript. Microsoft first released it on 1 October 2012, version 0.8, after two years of internal development. The person behind the project is Anders Hejlsberg, lead architect of C# and the creator of Delphi and Turbo Pascal. Teams inside Microsoft were building large web applications in JavaScript, with hundreds of engineers working on one codebase. But JavaScript gave the machine no way to check that a function was receiving the kind of data it needed.
TypeScript is open source, released under the Apache 2.0 license, so you can use it for free and read the full source of the compiler.
Back to the small shop from the opening. The checkout page has a function that adds the item price to the delivery fee:
function total(price, deliveryFee) {
return price + deliveryFee;
}
const order = { id: "DH-101", total: 135000 };
console.log("Total:", total(120000, "15000"));
console.log("Order total:", order.totall);
This code has two bugs. The first bug: deliveryFee receives the value "15000", a text string. The fee comes from an input field on a form, and data from input fields always arrives as a string. The second bug: the last line writes order.totall, misspelled against the declared property total. JavaScript reports neither bug. Running it with Node.js on this machine gives:
Total: 12000015000
Order total: undefined
The total becomes 12000015000, a meaningless number, and the order total becomes undefined, meaning no value at all. Neither stops the page. The customer sees a strange number, and the developer has to hunt for where the bug sits.
The problem is not careless coding. JavaScript only knows the type of a value while the code is running. While you write code, nothing checks whether price and deliveryFee are both numbers, or whether the property totall exists. The bug only shows up after the customer has already seen the wrong number on screen.
Take the same code, rewrite it in TypeScript, and add type notes to the two function parameters:
function total(price: number, deliveryFee: number): number {
return price + deliveryFee;
}
const order = { id: "DH-101", total: 135000 };
console.log("Total:", total(120000, "15000"));
console.log("Order total:", order.totall);
The word number after each colon is a type note. It tells the compiler that price and deliveryFee must be numbers, and that the function must return a number. Running tsc version 7.0.2 on this file reports two errors, before any code runs:
order.ts(6,37): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
order.ts(7,35): error TS2551: Property 'totall' does not exist on type '{ id: string; total: number; }'. Did you mean 'total'?
The first error says plainly that a string argument cannot go to a number parameter. The second error says the property totall does not exist, and even suggests the correct name total. The error shows up while you write code, inside your editor, not while a customer is looking at the page.
Fix both bugs and the code runs correctly:
function total(price: number, deliveryFee: number): number {
return price + deliveryFee;
}
const order = { id: "DH-101", total: 135000 };
console.log("Total:", total(120000, 15000));
console.log("Order total:", order.total);
Running tsc this time reports no errors, and the output is exactly as expected:
Total: 135000
Order total: 135000
One small example is enough to show how TypeScript works. You write JavaScript as before, add a few type notes, and the compiler does the checking for you.

Knowing what is TypeScript is not enough. You also need to know what happens to the type notes after the check.
They disappear. After tsc finishes checking, it erases all the type notes and produces plain JavaScript. The code runs in the browser exactly as if you had written it in JavaScript from the start. TypeScript adds no runtime library and changes no behavior of the code. According to the official documentation, TypeScript never changes the runtime behavior of JavaScript code.
This leads to one important consequence: types exist only at compile time. A wrongly typed value that slips past the compiler still goes wrong at runtime. For example, data from an API that arrives in a different shape than declared. TypeScript checks your code, not data from outside. You can read more about APIs in the article What is an API.
TypeScript is also a superset of JavaScript. Every valid JavaScript program is a valid TypeScript program. You can rename a .js file to .ts and the compiler still accepts it. That makes moving an old project to TypeScript gentle work: convert one file at a time, add types gradually, instead of rewriting from scratch.
You will meet two ideas as soon as you start. The first is the any type. Giving a value the type any tells the compiler not to check that value. It helps while you convert old code and do not want to type everything yet, but use it too much and TypeScript loses its effect. The second is strict mode, turned on in the tsconfig.json configuration file. It makes the compiler check more strictly, for example by not letting a null value slip into a place that needs a string. Turning on strict mode from the start of a new project is a common choice.
TypeScript also infers types for you in many cases. Write const name = "Lan" and the compiler knows by itself that name is a string, with no : string needed from you. You only write types where the compiler cannot infer them, such as function parameters or data returned from an API. So TypeScript code is barely longer than JavaScript.
Catching bugs at compile time is the clearest benefit. But TypeScript gives you a few more things besides. When the compiler knows the type of every value, your editor knows it too.
Type order. and the editor lists the properties right away: id, total. You do not have to remember property names, and you do not have to open another file to check. This feature is called code completion, and it runs on the same type information the compiler uses to catch bugs.
Renaming a function or a property is safer too. The editor knows every place that uses the name, so renaming it in one place renames it everywhere. With plain JavaScript, renaming is manual work and easy to get wrong. In a codebase of a few hundred lines, that hardly matters. In a codebase of tens of thousands of lines, it is the difference between an afternoon and a week.
Types also work as living documentation for the code. Read the signature of a function and you know at once what it needs and what it returns, without reading the whole function body. A function that takes order: Order and returns number says far more than a function that takes order of unknown shape. When someone new joins the team, reading the types tells them most of how the code works.
Finally, types help AI coding tools write more accurate code. When the AI knows the exact types of each function, the code it suggests goes wrong less often. GitHub makes this point in its Octoverse 2025 report: statically typed languages help make AI-assisted coding more reliable in production.
TypeScript at the end of 2026 looks quite different from the start of the year. The reason is a major change to the compiler. On 11 March 2025, Anders Hejlsberg announced that the TypeScript team was rewriting the compiler in the Go language. The old version was written in TypeScript and ran on Node.js. The goal he stated then was to cut most build times by about 10 times, while also reducing memory use.
On 8 July 2026, Microsoft released TypeScript 7.0, the first stable release of the Go compiler. The result matched the stated goal. On large open source codebases, full builds usually run 8 to 12 times faster than TypeScript 6. Checking the VS Code codebase fell from 125.7 seconds to 10.6 seconds, 11.9 times faster. The Sentry codebase fell from 139.8 seconds to 15.7 seconds. Memory use during builds fell too: VS Code went from 5.2 GB to 4.2 GB.
Installing it works the same as before. You still install the typescript package from npm and still use the tsc command:
npm install -D typescript
npx tsc
The newest version at the time of writing is 7.0.2. During the preview period, the Go compiler had its own name, tsgo, and its own package, @typescript/native-preview. From the official 7.0 release, everything merged back into the familiar typescript package.
First, TypeScript 7.0 has no stable programming API for outside tools yet. Tools that rely on the compiler API cannot run with TypeScript 7 yet. Examples are typescript-eslint, and the template type checking in Vue, Svelte, Astro, and MDX. Microsoft says a new API will arrive in TypeScript 7.1. Second, TypeScript 6.0, released on 23 March 2026, is the last version built on the JavaScript codebase, and it serves as a bridge. If your project uses tools that do not work with version 7 yet, staying on version 6 is the safe choice.
For new learners, TypeScript 7 changes nothing about the language. You need no new syntax.
TypeScript is no longer a choice for large projects only. According to GitHub’s Octoverse 2025 report, August 2025 was the first month TypeScript passed both Python and JavaScript. It became the most used language on GitHub, measured by distinct monthly contributors. In one year, TypeScript gained about 1 million contributors, up 66% year over year.
The Stack Overflow Developer Survey 2025 points the same way. Of the 31,771 people who answered the language question, 43.6% said they had done extensive work with TypeScript in the past year. That puts it fifth, after JavaScript, HTML/CSS, SQL, and Python. Among professional developers, 48.8% use TypeScript. You can see the full results on the survey technology page.
The two numbers measure different things: GitHub counts contributors on its platform, Stack Overflow asks survey respondents. But both point the same way: TypeScript has become the default choice for many new web projects.
What is TypeScript is clear by now, but should every project use it? The direct answer is no. TypeScript adds a compile step and extra work writing types. For some projects, that cost is larger than the benefit.
A website with only a few dozen lines of JavaScript, for a contact form or a mobile menu, does not need TypeScript. Type errors in a short file usually show up the moment you try the page in the browser. Writing types for every variable only makes the code longer without catching any error worth catching.
A script you write once and throw away usually does not need TypeScript either. For example, a script that renames a batch of files, or fetches data from an API to print a table. You write it, run it once, check the result, and move on. If the script is wrong, you see it at once and fix it.
People new to programming should also learn JavaScript first. TypeScript is JavaScript plus type checking, so you cannot learn TypeScript while skipping JavaScript. Once you have written JavaScript long enough to hit type errors like the one at the start of this article, TypeScript starts to make real sense. You can start from the basics in the article What is JavaScript. If you want to start with AI or data instead, read What is Python to see whether Python fits you.
TypeScript starts paying off when your code grows past a few hundred lines. It also pays off when two or more people edit one codebase, or when the code has to live long and change many times.
In those cases, a type error no longer shows up the moment you try the page. It can sit quietly for weeks, then appear when someone else calls your function with data in the wrong shape.
One more practical point: if your project stores data with a strict structure, the type thinking of TypeScript will feel familiar. For example, a database table where every column has its own type. In SQL, every column in a table also has a fixed data type. You can read the article What is SQL to see how data types work in a database.
Starting with TypeScript takes little effort. You need Node.js installed on your machine, then do three things in an empty folder:
npm init -y
npm install -D typescript
.ts and add types to the function parameters, like the order.ts example above.npx tsc order.ts
node order.js
The tsc command checks the types and creates a matching .js file. If there is a type error, tsc reports it and creates no new file. The node command runs that .js file like any other JavaScript file.
When the project grows past one file, add a tsconfig.json file to record your choices. The file records turning on strict mode, the folder with the source code, and the folder with the compiled code. Most modern frameworks create this file for you when you start a project.
| Wrong | Right |
|---|---|
| TypeScript is a completely different language from JavaScript. | TypeScript is JavaScript plus static types. Every valid JavaScript program runs in TypeScript. |
| TypeScript makes code run faster. | TypeScript only checks code before it runs, then erases the types and produces plain JavaScript. Running speed does not change. What got faster is the TypeScript 7 compiler. |
| You must write a type for every variable to use TypeScript. | The compiler infers types in many cases. You only write types where it cannot infer them, such as function parameters. |
| TypeScript means no more runtime errors. | TypeScript only catches type errors in your code. Logic errors, bad data from an API, and network errors still happen as before. |
| Every small project should use TypeScript. | Projects of a few dozen lines or one-off scripts usually do not need it. TypeScript pays off when code is long, edited by many people, or meant to live long. |
TypeScript is JavaScript plus a static type system. You write JavaScript as usual, add type notes to values, and the compiler checks for type errors before the code runs. JavaScript has no such check. After checking, TypeScript erases the type notes and produces plain JavaScript for the browser to run. You can read more in the article What is JavaScript.
Yes. TypeScript builds on JavaScript, so everything you know about JavaScript applies in TypeScript. The official documentation also states clearly that you cannot learn TypeScript while skipping JavaScript. Learn JavaScript first, then add TypeScript once you have hit type errors in a real project.
Yes. TypeScript is open source software from Microsoft, under the Apache 2.0 license. You install it from npm without paying anything.
Now you know what is TypeScript, the best next step is to try it on one small file. Take a JavaScript file you already have, rename it to .ts, run tsc, and see what it reports. The first errors are usually familiar ones. A variable that is sometimes a number and sometimes a string. Or a property misspelled long ago that nobody noticed.
Once you are used to writing types for functions and objects, turn on strict mode in tsconfig.json and see what else the compiler catches. That is when TypeScript stops being a checking tool and becomes a more disciplined way to write code.
Comments
You can use your Google account to comment. Google only shares your verified name and email address to display your name. You can log out at any time.
Sign in with GoogleNo comments yet. Be the first!