Transpiled, not type-checked
TypeScript is compiled with Sucrase in a Web Worker. Types are removed and modern syntax is kept, so execution is fast and line numbers in stack traces match your source. There is no type checker in this build: a type error will not stop the code from running. The badge next to Run says APPROX for that reason.
Use “Show transpiled JavaScript” from the command palette to see exactly what runs, along with a version 3 source map.
Modules and tests
Relative imports between project files work, including top-level await in the entry file. Tests use a Jest-compatible subset (describe, test, expect with toBe, toEqual, toThrow, resolves and more) and run in the same sandboxed Worker.
How to use it
- Press Run (Ctrl/Cmd+Enter) to execute src/index.ts.
- Open src/duration.test.ts and press Run to see passing and failing tests.
- Set the Deterministic preset in Settings to freeze Date and seed Math.random.
Questions
Does it check types?
No. Types are stripped without checking. Use your local tsc or IDE for type errors; this editor focuses on running and testing code quickly.
Which TypeScript syntax is supported?
What Sucrase supports: interfaces, generics, enums, type-only imports, satisfies and modern ECMAScript syntax. Legacy decorators are not transformed. Syntax errors are reported with line and column.
What happens with an infinite loop?
Code runs in a Worker with a hard time limit (5 seconds by default). Stop terminates it immediately; your files are not affected.