JavaScript with a type system. You add type annotations; the compiler checks them and then strips them away, leaving plain JavaScript that runs anywhere.
This runs the real TypeScript compiler in your browser. Edit the code on the left and watch it transpile to JavaScript on the right in real time. Notice how all the types simply disappear.
Loading the TypeScript compiler…The point of TypeScript is catching mistakes before the code runs. Click a snippet to load it into the compiler above — the syntax checker flags problems instantly. (Deep type-checking like “string is not a number” normally lights up live in your editor.)
Each loads into the live compiler at the top so you can see real diagnostics.
Interfaces and type aliases are pure compile-time documentation — they produce zero JavaScript. enums do compile to a small object. Load the example to prove it.
typescript.js) loaded from a CDN and run in your browser to transpile live and report diagnostics. Also used: a little vanilla JavaScript to wire the editor to the compiler, plus the shared CSS shell. Full editor-grade type-checking runs as a language service in code editors; here we use the compiler's transpile + syntactic diagnostics.