webdev_typescript_playground
Transpile TypeScript to JavaScript by stripping type annotations and type-only imports/exports, with optional ES5 downleveling. Also runs lightweight type checks for common errors.
Instructions
TypeScript Playground (transpile to JavaScript). Transpile TypeScript source to JavaScript by regex stripping of type annotations, interfaces, and type-only imports/exports, with optional ES5 downleveling (const/let to var, arrow functions, template literals); also runs a lightweight type check that flags uninitialized const, type-mismatch assignments, and implicit-any parameters. Use it to preview compiled output and catch obvious type errors; use webdev_json_to_typescript instead to derive interfaces from JSON, or webdev_javascript_beautifier to reformat plain JS. Does not execute the code — pure string transformation that runs locally, read-only, non-destructive, contacts no external service, and is rate-limited. Returns the compiled JavaScript, detected diagnostics, extracted type symbols, and a success flag.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | TypeScript source to transpile (alias: typescript). Must be non-empty. | |
| target | No | ECMAScript target. Only "ES5" triggers downleveling (const/let to var, arrows to functions, template literals to concatenation); any other value emits as-is. | ES2017 |
| module | No | Module system label echoed back in compilerOptions; does not alter output. | CommonJS |
| strict | No | Strict-mode flag echoed back in compilerOptions; does not change checks. | |
| noImplicitAny | No | When true, flags function parameters with no type annotation as implicit-any diagnostics. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| compiledJs | No | The transpiled JavaScript output. | |
| errors | No | Detected type/syntax diagnostics; empty when none. | |
| typeInfo | No | Extracted typed symbols (variables and functions). | |
| success | No | True when no diagnostics were found (errors is empty). | |
| compilerOptions | No | The normalized options actually applied. |