TypeScript
noun · programming language
A typed superset of JavaScript developed by Microsoft that adds an optional static typing system to the language — enabling error detection at compile time rather than runtime, drastically reducing production bugs and improving maintainability of large-scale projects.
An open-source programming language that transpiles to standard JavaScript, compatible with all browsers and Node.js environments — offering advanced features like interfaces, generics, enums, and decorators while maintaining full compatibility with the existing JavaScript ecosystem.
An industry standard adopted by Angular, internal projects at Google, Microsoft, and Slack, TypeScript has become the preferred choice for professional development teams seeking to secure their code, improve IDE autocompletion, and facilitate collaboration on complex codebases.
To code in TypeScript, start by installing the compiler via `npm install -g typescript`, then create a file with the `.ts` extension. You write standard JavaScript enriched with type annotations: `function greet(name: string): string return 'Hello ' + name; `. Then compile with `tsc` to generate the equivalent JavaScript file. Modern IDEs like VS Code offer native integration with autocompletion and real-time error detection, which considerably accelerates development.
TypeScript is particularly recommended for large-scale projects involving multiple developers, critical applications where reliability is paramount, and codebases intended to evolve over the long term. It is ideal for backend APIs with Node.js, complex frontend applications with React or Angular, and shared libraries across teams. As soon as a project exceeds a few hundred lines or involves more than one developer, TypeScript becomes a worthwhile investment in terms of quality and productivity.
Using TypeScript can reduce production bugs by up to 15% through compile-time type checking, according to a study by University College London. It drastically improves the developer experience with intelligent autocompletion, easier code navigation, and safe refactoring. TypeScript also makes code self-documenting: type signatures serve as living documentation that IDEs leverage to guide developers. It is a productivity and software quality tool that we recommend for any ambitious professional project.
TypeScript is used by the world's largest technology companies: Microsoft (which created it for VS Code development), Google (which adopted it for Angular), Slack, Airbnb, Bloomberg, and Stripe. The Next.js team at Vercel uses it for the development of the framework itself. According to the State of JS 2024, TypeScript is the most appreciated language in the JavaScript ecosystem with a satisfaction rate above 90%. This massive adoption guarantees a rich type ecosystem and an active community.
TypeScript was created by Anders Hejlsberg at Microsoft and made public in October 2012. Anders Hejlsberg is also the creator of C# and Turbo Pascal, making him one of the most influential engineers in the history of programming. The project was born from Microsoft's need to develop large-scale web applications with JavaScript while retaining the type safety offered by compiled languages. Today, TypeScript is an open-source project hosted on GitHub with thousands of contributors.
To use TypeScript in a project, initialize the configuration with `npx tsc --init` which generates a `tsconfig.json` file allowing you to customize the strictness level and compilation options. Rename your `.js` files to `.ts` (or `.tsx` for React) and progressively add type annotations. Modern frameworks like Next.js and Angular offer native TypeScript support with zero configuration. Adoption can be gradual: TypeScript accepts pure JavaScript, allowing you to migrate your codebase at your own pace.
The fundamental difference is that TypeScript adds a static type system to JavaScript: variables, parameters, and function returns have explicit types verified before execution. JavaScript is dynamically typed — type errors are only detected at runtime. TypeScript also introduces interfaces, enums, generics, and access modifiers. However, all valid JavaScript code is also valid TypeScript, and TypeScript transpiles to pure JavaScript for execution. It is therefore a security layer, not a different language.