๐ŸŒ
TypeScript
typescriptlang.org โ€บ play
TypeScript: TS Playground - An online editor for exploring TypeScript and JavaScript
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.
Object Types
How TypeScript describes the shapes of JavaScript objects.
More on Functions
Functions are the basic building block of any application, whether theyโ€™re local functions, imported from another module, or methods on a class. Theyโ€™re also values, and just like other values, TypeScript has many ways to describe how functions can be called.
Utility Types
In the example above, the methods ... target and a source for the this type in methods. The ThisType<T> marker interface is simply an empty interface declared in lib.d.ts. Beyond being recognized in the contextual type of an object literal, the interface acts like any empty interface. To help with string manipulation around template string literals, TypeScript includes a ...
Everyday Types
For example, if youโ€™re using document.getElementById, TypeScript only knows that this will return some kind of HTMLElement, but you might know that your page will always have an HTMLCanvasElement with a given ID. In this situation, you can use a type assertion to specify a more specific type: ... Like a type annotation, type assertions are removed by the compiler and ...
๐ŸŒ
Programiz
programiz.com โ€บ typescript โ€บ online-compiler
Online Typescript Compiler (Editor) - Programiz
Online Python Compiler Online R ... Online Typescript Editor for free // Write, Edit and Run your Typescript code using TS Online Compiler console.log("Try programiz.pro");...
๐ŸŒ
W3Schools
w3schools.com โ€บ typescript โ€บ typescript_editor.php
TypeScript Online Editor (Compiler)
With our online TypeScript editor, you can edit TypeScript code, and view the result in your browser.
๐ŸŒ
OneCompiler
onecompiler.com โ€บ html โ€บ 3xwrb4kct
sandbox.ts - HTML - OneCompiler
Write, Run & Share HTML code online using OneCompiler's HTML online Code editor for free. It's one of the robust, feature-rich online Code editor for HTML language, running on the latest version HTML5. Getting started with the OneCompiler's HTML compiler is simple and pretty fast.
๐ŸŒ
Playcode
playcode.io โ€บ typescript-playground
TypeScript Playground - Free Online TS Playground
This TypeScript playground has everything: strict mode, ESNext features, multiple files, and it's fast. I've switched from the official playground because this TypeScript online editor has better UX. ... Best TypeScript compiler online. I prototype all my TypeScript code here first. The playground gives instant feedback on type errors, which is perfect for iterating on complex types. The TypeScript online compiler handles everything perfectly. ... Learn HTML, CSS, JavaScript and React easily through our interactive PlayCode Courses.
๐ŸŒ
OneCompiler
onecompiler.com โ€บ typescript
TypeScript Online Compiler
OneCompiler's TypeScript online editor helps you to write, compile, debug and run TypeScript code online.
๐ŸŒ
JSFiddle
jsfiddle.net โ€บ boilerplate โ€บ typescript
TypeScript - JSFiddle - Code Playground
JSFiddle - Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle.
๐ŸŒ
MyCompiler
mycompiler.io โ€บ online-typescript-compiler
Online TypeScript Compiler - myCompiler
Online TypeScript Compiler - Edit, Compile and Run your TypeScript code with myCompiler IDE. Simple and easy to use IDE with built in support for TSC for compiling TypeScript programs.
๐ŸŒ
JDoodle
jdoodle.com โ€บ online-compiler-typescript
Online Compiler and Editor/IDE for Java, C, C++, PHP, Python, Ruby, Perl - Code and Run Online
JDoodle is an Online Compiler, Editor, IDE for Java, C, C++, PHP, Perl, Python, Ruby and many more. You can run your programs on the fly online, and you can save and share them with others. Quick and Easy way to compile and run programs online.
Find elsewhere
Top answer
1 of 3
37

Transpiling ts to js is as simple as loading the typescript.js file from typescript repo or npm, and using it's window.ts.transpile(tsCode)

JSFiddle

<script src="https://unpkg.com/typescript@latest/lib/typescript.js"></script>
<script>
const tsCode = 'let num: number = 123;';
const jsCode = window.ts.transpile(tsCode);
document.write(jsCode);
</script>

Outputs:

var num = 123;

You can also pass the ts compiler options object as second argument like:

ts.transpile(tsxCode, { jsx: "react", target: "es2015" });

Though for meaning of values you'll likely have to dive into the source code.




Since this question got re-opened (just as planned >:D), I'm also re-posting my comment here.

@basarat's solution was great; even though his lib is outdated and abandoned, it helped me a lot in writing another, self-sufficient modern lib with support for sub-dependencies: ts-browser

Usage: (given you use relative paths in all your ts files)

<!-- index.html -->
<script type="module">
    import {loadModule} from 'https://klesun.github.io/ts-browser/src/ts-browser.js';
    // language=file-reference
    const entryScriptPath = './index.ts';
    loadModule(entryScriptPath).then(indexModule => {
        return indexModule.default(document.getElementById('composeCont'));
    });
</script>
// index.ts
import {makePanel} from './utils/SomeDomMaker'; // will implicitly use file with .ts extension

export default (composeCont) => {
    composeCont.appendChild(makePanel());
};
2 of 3
26

You can use typescript-script : https://github.com/basarat/typescript-script

However do not do this in production as it is going to be slow.

You can use webpack (or a similar module bundler) to load npm packages in the browser.

๐ŸŒ
CodeSandbox
codesandbox.io โ€บ s โ€บ typescript-with-html-ixiy9
Typescript with html - CodeSandbox
June 1, 2020 - Typescript with html by taeyooniSK
Published ย  Jun 01, 2020
Author ย  taeyooniSK
๐ŸŒ
Playcode
playcode.io โ€บ javascript-compiler
JavaScript Online Compiler & Editor - Run JS Code Free
The JavaScript editor handles TypeScript, JSX, and ES2026 perfectly. I can write, test, and share code without leaving my browser. Best online JavaScript editor for serious work. ... Run JavaScript code instantly, no setup. No more waiting for webpack or node. This JS compiler gives instant feedback.
๐ŸŒ
Paiza
paiza.io โ€บ en โ€บ languages โ€บ typescript
Online PHP/Java/C++... editor and compiler | paiza.IO
Paiza.IO is online editor and compiler. Java, Ruby, Python, PHP, Perl, Swift, JavaScript... You can use for learning programming, scraping web sites, or writing batch
๐ŸŒ
Diversify India
diversifyindia.in โ€บ diversify india โ€บ play store โ€บ online typescript compiler
Online TypeScript Compiler
January 12, 2025 - Full JavaScript Compiler Support: The playground supports all features available in our online JavaScript (JS) compiler. Semantic Error Logging: Captures and logs semantic errors produced by the TypeScript compiler for better debugging. TypeScript to JavaScript Conversion: Automatically compiles TypeScript code into JavaScript code. Customizable Compiler Configuration: Supports configurations using tsconfig.json to meet specific project requirements. Integrated HTML and CSS Editors: Includes editors for HTML and CSS, making it suitable for learning and experimenting with the Document Object Model (DOM) API in TypeScript.
๐ŸŒ
StackBlitz
stackblitz.com
StackBlitz | Instant Dev Environments | Click. Code. Done.
StackBlitz is the collaborative browser-based IDE for web developers. StackBlitz eliminates time-consuming local configuration and lets developers spend more time building.
๐ŸŒ
W3Schools
w3schools.com โ€บ tryit
W3Schools Online Code Editor - Tryit Yourself
If you are new to coding, we suggest that you start with HTML, and move on to CSS and JavaScript: HTML Tutorial CSS Tutorial JavaScript Tutorial ยท The backend code compiler allows you to edit Python, C#, C++, PHP, Node.js, Java, Bash, Clojure, Fortran, Go, Kotlin, Perl, R, Ruby, Scala, Swift, TypeScript, and VB.NET code, and view the result in your browser.
๐ŸŒ
Codeanywhere
codeanywhere.com โ€บ languages โ€บ typescript
Typescript Online IDE, Compiler, Interpreter & Code Editor ยท AI Cloud IDE ยท Codeanywhere
Write and run Typescript code using our Python Cloud-Based IDE. You can code, learn, build, run, deploy and collaborate right from your browser!
๐ŸŒ
ScholarHat
scholarhat.com โ€บ compiler โ€บ typescript
TypeScript Online Compiler | TypeScript Online Editor
TypeScript Online Compiler and Editor designed for modern web development. Speed up your TypeScript coding and testing.
๐ŸŒ
JetBrains
jetbrains.com โ€บ webstorm
WebStorm: The JavaScript and TypeScript IDE, by JetBrains
June 1, 2021 - Make development more productive and enjoyable with WebStorm, the IDE for JavaScript and related technologies.
๐ŸŒ
Replit
replit.com โ€บ languages โ€บ typescript
TypeScript Online Compiler & Interpreter - Replit
Write and run TypeScript code using our TypeScript online compiler & interpreter. You can build, share, and host applications right from your browser!