Compiler
Compiler Visualizer
Follow your code through every phase of the TypeScript compiler. Click a phase in the pipeline or use the arrows to step through.
The pipeline re-runs automatically as you type.
Source Code
Everything starts with your .ts file — just text. The compiler has not looked at it yet.
interface Point {
x: number;
y: number;
}
function distance(a: Point, b: Point): number {
const dx = a.x - b.x;
const dy = a.y - b.y;
return Math.floor(Math.sqrt ? (dx * dx + dy * dy) : 0);
}
const origin: Point = { x: 0, y: 0 };
const target: Point = { x: 3, y: 4 };
console.log("squared distance:", distance(origin, target));