TypeScript
TypeScript 5.4

Run TypeScript 5.4 Online

Compile and execute TypeScript code instantly in a secure, isolated sandbox. Full type checking with no setup required.

main.ts
Output
Click "Run Code" to execute...

About TypeScript

TypeScript is a type-safe superset of JavaScript developed by Microsoft for enterprise-grade applications. It catches errors at compile time, provides better tooling through type inference, and compiles down to clean JavaScript.

Our sandbox runs TypeScript 5.4 with full type checking and compilation.

Sandbox Features

  • Secure execution with Docker + gVisor isolation
  • TypeScript 5.4 with full type checking
  • Up to 300s execution time (Pro tier)
  • Stdin support for interactive programs
  • REST API for programmatic access
  • No setup or installation required

Use TypeScript with stateful sessions

Open a session once, then call execute repeatedly — variables, files, and installed packages persist between runs. Perfect for code interpreters and REPL-style agents.

# 1. Create a session
curl -X POST https://api.sandboxapi.dev/v1/sessions \
  -H "X-RapidAPI-Key: $KEY" \
  -d '{"language":"typescript","idle_ttl":300}'
# → {"id":"sess_abc","language":"typescript",...}

# 2. Execute — first call
curl -X POST https://api.sandboxapi.dev/v1/sessions/sess_abc/execute \
  -H "X-RapidAPI-Key: $KEY" \
  -d '{"code":"let x: number = 42"}'

# 3. Execute again — state carries over
curl -X POST https://api.sandboxapi.dev/v1/sessions/sess_abc/execute \
  -H "X-RapidAPI-Key: $KEY" \
  -d '{"code":"console.log(x * 2)"}'
Read the sessions docs →

Run Code in Other Languages

Need More? Get API Access

Integrate secure code execution into your own apps with our REST API. Free tier includes 500 executions per month.

Get API Key on RapidAPI