TypeScript Playground

TypeScript Playground

Compile TypeScript to JavaScript in-browser using the TS compiler loaded from CDN. Supports generics, classes, decorators, utility types; configurable target and module format.

Click Compile to load the TypeScript compiler and transpile your code.

~5MB download on first use — cached in your browser after that.

Compile TypeScript to JavaScript in-browser with full semantic type-checking, then run the output in a sandboxed iframe. TypeScript compiler loaded from CDN on first use (~5 MB, cached).

TypeScript Playground

Compile TypeScript to JavaScript in-browser using the TS compiler loaded from CDN. Supports generics, classes, decorators, utility types; configurable target and module format.

Common uses

  • Compile a generic utility type to see the output JS
  • Test decorator syntax and view transpiled output

Also searched as

  • typescript playground online
  • compile typescript to javascript online
  • typescript ast explorer
  • typescript decorators playground
  • see transpiled output of generic types
  • typescript target es5 vs es2022 output
  • typescript to commonjs or esm online
  • typescript type checking errors online

Frequently asked questions

Is my data uploaded to a server?

No — your code compiles and runs entirely in a sandboxed iframe in your browser. The TypeScript compiler itself is loaded from a CDN (unpkg.com) on first use, but your code is never sent anywhere unless you explicitly click "Open in TS Playground."

How do I compile TypeScript to JavaScript online?

Type your code in the Compiler tab and the transpiled JavaScript appears, with a selectable target (ES5, ES2015, ES2022) and module format (ESNext, CommonJS, AMD).

Can I view the AST of my TypeScript?

Yes, the AST Explorer tab shows the syntax tree.

Does it show type errors?

Yes, the compiler reports syntax and type diagnostics, and you can toggle strict mode.

Where does the compiler come from?

The TypeScript compiler is loaded from a CDN and runs in your browser.