Generic identity function
Input: function identity<T>(value: T): T { return value; } const n = identity<number>(42);
Output: function identity(value) { return value; } var n = identity(42);
500+ fast, free tools. Most run in your browser only; Image & PDF tools upload files to the backend when you run them.
Transpile TypeScript to JavaScript in your browser with configurable target and strict mode.
TypeScript Playground transpiles TypeScript 5 to JavaScript entirely in your browser, using the official TypeScript compiler loaded from jsDelivr CDN. There is nothing to install — on first use the compiler (~10 MB) loads once and is cached. Write TypeScript in the left editor, choose your JavaScript output target (ES5, ES2015, ES2020, or ESNext), toggle strict mode, and click Transpile to see the generated JavaScript in the right panel. Type-stripping uses ts.transpileModule, which is fast and produces clean output. Compiler diagnostics (type errors and warnings) are displayed below the editors when present. The tool is ideal for learning TypeScript, validating type syntax, quickly seeing how generics or decorators transpile, and checking what ES2020 optional chaining looks like after downlevelling to ES5.
Input: function identity<T>(value: T): T { return value; } const n = identity<number>(42);
Output: function identity(value) { return value; } var n = identity(42);
Input: const u: { name?: { first?: string } } = {}; const first = u.name?.first ?? 'unknown';
Output: var _a, _b; var u = {}; var first = (_b = (_a = u.name) === null || _a === void 0 ? void 0 : _a.first) !== null && _b !== void 0 ? _b : 'unknown';
Input: async function fetchUser(id: number): Promise<{ id: number }> { return { id }; }
Output: async function fetchUser(id) { return { id }; }