TypeScript Playground

Write TypeScript in the left panel and see the stripped JavaScript output on the right. Type annotations, interfaces, generics, and access modifiers are removed automatically.

Examples
TSTypeScript Input21 lines
JSStripped JS Output18 lines
class UserService {
  baseUrlapiKeyconstructor(baseUrl, apiKey) {
    this.baseUrl = baseUrl
    this.apiKey = apiKey
  }

  async getUser(id): Promise<User> {
    const res = await fetch(`${this.baseUrl}/users/${id}`)
    return res.json() 
  }

  buildHeaders(): Record<string, string> {
    return {
      Authorization: `Bearer ${this.apiKey}`,
      'Content-Type': 'application/json',
    }
  }
}

Note: This tool strips TypeScript syntax using regex — it does not invoke the TypeScript compiler. The output may not be valid JavaScript for all edge cases. For full compilation, type checking, and declaration output, use typescriptlang.org/play.