TypeScript · types stripped, then run
TypeScript in,
running page out.
Paste annotated code and CodeRush recognises it as TypeScript, strips the types in your browser with a vendored compiler, and runs the JavaScript in a sandboxed frame. Nothing to install and nothing to configure.
- No tsconfig, no install
- Compiles in your tab
- Syntax errors land in Problems
What the compiler does here
Type erasure, not type checking.
Annotations, interfaces, type aliases and generics are removed and the remaining JavaScript runs. That is the honest description: CodeRush is a runner, not a type checker. It will not tell you that a string was handed to a function expecting a number — it will run the code and show you what happened.
Syntax that cannot be parsed is a different matter. The Problems panel parses your source locally, without executing it, and reports the error with its line, so a stray brace is a message rather than a blank preview.
type Sketch = { name: string; open: boolean };
const sketch: Sketch = { name: 'pool blue gradient', open: true };
const label = (s: Sketch): string => s.name + (s.open ? ' — still open' : ' — shipped');
document.body.textContent = label(sketch);
document.body.style.font = '400 6vw Georgia, serif';
console.log(label(sketch));
TSX is the same trip with React attached
One detector, two outcomes.
Add JSX tags to typed code and the detector calls it TSX instead of TS. The pad then compiles it with the same vendored Babel, pairs it with the vendored React build, and mounts the last component it finds. Both compilers are files in this repository, fetched only when a paste needs them, so an empty pad stays quiet.
That split matters when you are reading someone else's answer: a snippet with annotations and no tags is a script, and a snippet with <Component /> in it is a component. The source badge always shows which one CodeRush decided on, and you can say so explicitly from the command palette if it guessed differently from what you meant.
A sandbox, a console, a link
The rest of the pad comes along.
Compiled output runs in the same sandboxed frame as everything else: no access to the pad, no same-origin privileges, outside hosts paused until you allow them. Logs and errors land in the Console drawer with their source lines.
When it works, keep it as a local snapshot or send it as a Rush link — the source travels in the fragment, which means your annotated original is what the other person opens, not a compiled artefact.
Questions
- Does CodeRush type-check my TypeScript?
- No. It strips the types and runs the JavaScript. Syntax errors are reported by the local Problems panel, but type errors are not, and the page says so rather than implying otherwise.
- Which compiler is used?
- A vendored copy of Babel standalone, committed in the repository and loaded only when a paste needs it.
- Does TSX work too?
- Yes. Typed code containing JSX tags is detected as TSX, compiled with the same vendored Babel, and mounted with the vendored React build.
- Is anything uploaded to compile it?
- No. Compilation happens in your tab. The only files requested are this site’s own.