Welcome to XCODX Online Compiler
Quick Start:
Ctrl+Enter Run code
Ctrl+S Save / Download
Ctrl+L Clear output
Select a language and start coding.
Welcome to XCODX Online Compiler
Quick Start:
Ctrl+Enter Run code
Ctrl+S Save / Download
Ctrl+L Clear output
Select a language and start coding.
TypeScript is what most professional JavaScript becomes at scale: a static type layer, created at Microsoft in 2012, that catches whole classes of bugs before the code ever runs. Slack, Airbnb, and Stripe migrated massive codebases to it, VS Code and Angular are written in it, and the TypeScript 5.x line keeps shipping faster compilation and smarter inference. On this page your file is type-checked and compiled first — so you see compiler errors the way a real toolchain reports them — then executed on Node.js in an interactive terminal where stdin prompts genuinely wait for your keystrokes. There's nothing to configure: no tsconfig, no npm init, just write and run.
declare var require: any; // Node's readline is available at runtime
const readline = require("readline");
type Grade = "pass" | "fail";
interface Student {
name: string;
score: number;
}
function grade(s: Student): Grade {
return s.score >= 60 ? "pass" : "fail";
}
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
rl.question("Student name: ", (name: string) => {
rl.question("Score (0-100): ", (raw: string) => {
const s: Student = { name: name, score: parseInt(raw, 10) };
console.log(s.name + " scored " + s.score + ": " + grade(s));
rl.close();
});
});
Check whether a generic signature or a union type actually compiles before pushing it in a pull request, experiment with utility types like Partial, Pick, and Record, or work through typed versions of interview problems — many US tech companies now conduct front-end interviews in TypeScript rather than plain JavaScript. Bootcamp students converting JavaScript exercises to typed code can see compiler feedback instantly, and the live stdin support means challenge-style programs that read input line by line run the way graders expect.
Yes. After compilation your program runs on Node.js attached to a real terminal, so readline prompts stop and wait for whatever you type. Interactive flows — quizzes, menus, line-by-line stdin parsing — work during execution rather than requiring input pasted up front.
The file is compiled with the TypeScript compiler before it runs, so genuine type errors surface in the output just as they would from tsc in CI. That makes this a fast way to sanity-check whether an interface, generic constraint, or narrowing pattern is actually valid.
No package installs and no per-run tsconfig — the sandbox compiles a single file with sensible defaults. The full language is available (interfaces, enums, generics, mapped types, type guards), plus Node's built-in modules at runtime. For decorator metadata or path aliases, use a local project.
main.tsjavascriptprocess.stdinconst message: string = "Hello from TypeScript!";
console.log(message);
const greet = (name: string): void => {
console.log(`Welcome, ${name}!`);
};
greet("XCODX User");