TypeScript is now the most used programming language on GitHub, ahead of both JavaScript and Python. If you build anything for the web, you've almost certainly used something written in it, even if you've never written a line of it yourself. This post explains what TypeScript is, what it does and doesn't do, and whether it's worth adopting, without any code.
What TypeScript is
TypeScript is JavaScript with types added. Microsoft started work on it in 2012, led by Anders Hejlsberg, who also designed C#. It's free, open source and developed in public on GitHub.
The important thing to understand is that TypeScript isn't a replacement for JavaScript. Every JavaScript program is already a valid TypeScript program. TypeScript adds a way to describe what your data looks like, such as "this is a number", "this is a list of products" or "this field can be empty", and a tool that checks your code against those descriptions.
How it works
Browsers can't run TypeScript. You write your code in .ts files, and the TypeScript compiler checks it and then produces ordinary JavaScript. In that step the types are simply removed, so the JavaScript your visitors download is no bigger or slower than if you'd written it by hand.
That means all of TypeScript's checking happens while you're writing and building your code, not while it runs. It's a bit like a spelling and grammar checker for code: it doesn't change what you've written, it just tells you where it doesn't make sense.
What it gives you
It catches mistakes early. A large share of everyday JavaScript bugs come from using a value as though it's something it isn't: treating text as a number, reading a property that doesn't exist or forgetting that something might be empty. TypeScript points these out as you type, rather than leaving a visitor to find them.
Your editor understands your code. Because TypeScript knows what everything is, editors such as VS Code can autocomplete properties and functions, show you what a function expects, jump to where something is defined and rename things safely across a whole project. Much of this works in plain JavaScript files too, because the editor quietly uses TypeScript behind the scenes.
Changes are safer. When you rename a field or change what a function returns, TypeScript lists every place that needs updating. On a large or long-lived project, that confidence is often the biggest benefit of all.
The types document the code. A function's types tell the next developer, including future you, what it accepts and what it returns, and unlike comments, they can't quietly go out of date.
It helps teams and AI tools. Types give everyone working on a project, people and coding assistants alike, a shared and checkable description of how the pieces fit together. GitHub's own analysis suggests this is part of why TypeScript has grown so quickly recently.
What it doesn't do
TypeScript is sometimes oversold, so it's worth being clear about its limits.
- It doesn't check anything while your code runs. If an API returns something unexpected, or a visitor types something odd into a form, TypeScript won't notice, because it has already done its work and stepped aside. Data from outside your code still needs checking in the usual way.
- It doesn't make your site faster. The output is plain JavaScript. Performance depends on what that JavaScript does, not on whether it started out as TypeScript.
- It doesn't guarantee your code is correct. It can tell you that you passed a number where a number was expected, not that it was the right number.
- It isn't a different platform. Everything you know about the browser, the DOM and JavaScript itself still applies.
Where it's used
TypeScript is now the default for a large part of the JavaScript world:
- Frameworks. Angular is written in TypeScript, and React, Vue, Svelte, Next.js and Astro all support it out of the box. Laravel's official starter kits for React and Vue use it too.
- Tools. VS Code is written in TypeScript, as are many of the build tools and libraries you probably already use.
- Servers. Node.js can now run TypeScript files directly in its current versions, and Deno and Bun have run it natively from the start.
- Libraries. Most popular npm packages either ship their own type definitions or have them maintained by the community, so your editor knows how to use them.
What it costs
There's no licence fee, but there are costs worth weighing up.
- A learning curve. The basics take an afternoon. The more advanced parts of the type system take much longer, though you can go a long way without them.
- A build step. Browsers need JavaScript, so something has to turn TypeScript into it. For most projects that's already handled by a build tool such as Vite, but for a very small site it's one more moving part.
- Fighting the compiler. Occasionally you'll know your code is fine and TypeScript won't agree. Learning when to restructure the code and when to tell TypeScript to trust you is part of the learning curve.
- Gaps in third-party types. Older or less popular libraries sometimes have missing or out-of-date type definitions.
You don't have to switch all at once
One of TypeScript's strengths is that you can adopt it gradually. An existing JavaScript project can be checked by TypeScript without changing a single file, and you can then convert files one at a time, starting with the ones that change most often or break most easily. You can also start with relaxed settings and tighten them as the code improves, though for new projects the strictest settings are the default and the best place to start.
Where TypeScript is heading
2026 is a significant year for TypeScript.
- TypeScript 6.0, released in March, is the last version built on the original JavaScript-based compiler. It modernised the defaults, so new projects now get strict checking without having to ask for it.
- TypeScript 7 is a complete rewrite of the compiler in Go. It checks code in exactly the same way but is often around 10 times faster, which makes a real difference on large projects. It's in beta at the time of writing, with the stable release expected soon.
- Types in JavaScript itself. There's a long-running proposal to let JavaScript engines ignore type annotations, so typed code could run without a build step. It's still at an early stage, so don't plan around it yet.
Is it worth it?
For most new web projects, yes. If a project has more than a handful of JavaScript files, will be around for more than a few months or has more than one person working on it, TypeScript usually pays for itself quickly in bugs avoided and time saved.
It's less clear-cut for a small brochure site with a few lines of JavaScript, a quick prototype you'll throw away or a team with no time to learn something new right now. Even then, it's worth knowing the basics, because so much of the JavaScript ecosystem now assumes them.
If you're wondering whether TypeScript is right for a project of yours, take a look at my website development services or get in touch.