TypeScript
termKept in this browser · My desk
Microsoft's typed superset of JavaScript, announced on 1 October 2012, with version 1.0 on 2 April 2014; its lead architect is Anders Hejlsberg.
Announced as "a superset of JavaScript that combines type checking and static analysis, explicit interfaces, and best practices into a single language and compiler".
What it is. TypeScript is JavaScript with a static type system on top. Microsoft announced it on 1 October 2012 as a superset of JavaScript, so existing JavaScript is the starting point, and its compiler, tsc, checks the types and then emits plain JavaScript that any browser or runtime can execute. Version 1.0 followed on 2 April 2014, shipped with Visual Studio 2013, as an npm package and as source code.
How it works. The TypeScript Handbook spells out what happens to the types: annotations are not part of JavaScript, so no browser runs TypeScript unmodified; the compiler strips them out, and type annotations never change what the program does at run time. The same compiler can downlevel the code, rewriting newer ECMAScript constructs such as template strings into older ones for older engines. By default tsc still writes the JavaScript file even when it reports type errors, on the principle that a working JavaScript program being migrated should keep running; the noEmitOnError option stops that. TypeScript's types are structural: "type compatibility in TypeScript is based on structural subtyping", so two types with the same shape are interchangeable whatever they are called, in contrast with nominal typing. The handbook adds that the type system is deliberately not sound in places, allowing certain operations that cannot be known to be safe at compile time because they are useful and common.
Strictness. Checking is a dial, not a switch. The strict flag in the compiler configuration enables a family of checks for stronger guarantees of correctness, and the handbook singles out two: noImplicitAny, which reports variables whose type silently falls back to any, the type that turns checking off, and strictNullChecks, without which null and undefined are assignable to every other type, a habit the handbook calls the cause of countless bugs.
Origin and status. S. Somasegar's announcement described "a superset of JavaScript that combines type checking and static analysis, explicit interfaces, and best practices into a single language and compiler". Its lead architect is Anders Hejlsberg, also the designer of C#. The compiler is itself a program in a language: in March 2025 the team announced a native port written in Go to reduce most build times by 10x; on the Visual Studio Code codebase, about 1,505,000 lines, a check fell from 77.8 to 7.5 seconds, 10.4 times faster. Hejlsberg wrote that the JavaScript-based compiler would continue into the 6.x series and that the native codebase would be released as TypeScript 7.0 once it reached parity; on 23 November 2026 the npm registry listed 7.0.2 as the latest version of the typescript package, under the Apache-2.0 licence.
In practice. Microsoft presented TypeScript 1.0 as a language designed with large-scale JavaScript application development in mind, and it is now read directly by runtimes: Node.js added type stripping in v22.6.0, enabled it by default in v23.6.0 and v22.18.0 and declared it stable in v25.2.0 and v24.12.0; it replaces the TypeScript syntax with whitespace and performs no type checking, so tsc still has to run somewhere in the build.
What goes wrong. Because the types are erased, nothing checks data that arrives at run time: a JavaScript Object Notation (JSON) body from the network or a value from a user has whatever shape it has, whatever the annotation claims, and must be validated by code. Any annotation of type any, an unchecked cast, or the deliberately unsound corners of the type system let a wrong value through silently. TypeScript projects also install their dependencies from npm, the registry the Cybersecurity and Infrastructure Security Agency (CISA) warned about on 23 September 2025, when a self-replicating worm known as Shai-Hulud had compromised more than 500 packages and harvested GitHub personal access tokens and cloud keys for Amazon Web Services (AWS), Google Cloud Platform (GCP) and Microsoft Azure; CISA asked developers to rotate credentials, require phishing-resistant multi-factor authentication (MFA) and harden their GitHub settings.
Neighbours. JavaScript, which it compiles to and whose run-time behaviour it never changes; type-system, where its structural typing sits; C#, its designer's earlier language; Go, the language of its native compiler; and supply-chain-attack, the risk it shares with every npm project.
Also known as: ts language, typed javascript
Sources
- S. Somasegar, TypeScript: JavaScript Development at Application Scale, 1 October 2012: a superset of JavaScript with type checking (read 2026-11-23)
- Announcing TypeScript 1.0, TypeScript blog, 2 April 2014 (read 2026-11-23)
- Anders Hejlsberg, A 10x Faster TypeScript, 11 March 2025: a native port of the compiler written in Go; Hejlsberg lead architect of TypeScript (read 2026-11-23)
- TypeScript Handbook, Type Compatibility: based on structural subtyping, in contrast with nominal typing (read 2026-11-23)
- TypeScript Handbook, The Basics (read 2026-11-23): tsc; emitting with errors and noEmitOnError; erased types, annotations never change run-time behaviour; downleveling; strictness, noImplicitAny and strictNullChecks
- TypeScript TSConfig reference, strict (read 2026-11-23): the strict flag enables a wide range of type-checking behaviour for stronger guarantees of program correctness
- Node.js documentation, Modules: TypeScript (read 2026-11-23): type stripping added in v22.6.0, on by default from v23.6.0 and v22.18.0, stable from v25.2.0 and v24.12.0; TypeScript syntax replaced with whitespace and no type checking performed
- npm registry, typescript package, latest version record (read 2026-11-23): version 7.0.2; Apache-2.0 licence; the tsc binary
- GitHub Blog, 7 learnings from Anders Hejlsberg: the architect behind C# and TypeScript, copy made by the programming languages research the same day (read 2026-11-23): Hejlsberg as the architect of C# and of TypeScript
- CISA, Widespread Supply Chain Compromise Impacting npm Ecosystem, 23 September 2025 (read 2026-11-23): the self-replicating Shai-Hulud worm compromised over 500 packages; GitHub personal access tokens and AWS, GCP and Azure keys harvested; rotate credentials, phishing-resistant MFA