Interactive playground¶
This is a proof-of-concept in-browser TypeScript editor. It compiles TypeScript to JavaScript directly in your browser and prints the result.
Note
This page is a quick demo. It transpiles TypeScript and runs the emitted JavaScript. It does not perform full project-level type checking, and it cannot use Node.js or npm packages.
Editor¶
Write TypeScript in the box below and click Run TypeScript. If you arrived from another page, the starter code is already filled in.
Suggested things to try¶
- Add an explicit type annotation that conflicts with a value, such as
const count: number = 'hello', and see the transpile error. - Define an interface and a function that uses it.
- Use
mapandfilteron an array. - Try adding
importorfetchcalls — these will fail because the playground has no module loader or network.
How it works¶
- The page loads the
typescriptcompiler from a CDN. - When you click Run,
transpileModuleconverts the TypeScript to JavaScript in the browser. - The emitted JavaScript is evaluated, and
console.logoutput is captured into the result panel.
Limitations¶
- No full type checking. Complex type errors may not appear.
- No
npmpackages or Node.js APIs. - No
import/exportsupport. evalis used for the runner, so only run code you trust.