Scalable
TypeScript offers classes, modules, and interfaces to help you build robust components.
These features are available at development time for high-confidence application development, but
are compiled into simple JavaScript.
TypeScript types let you define interfaces between software components and to gain insight into the
behavior of existing JavaScript libraries.
Starts from JavaScript, Ends with JavaScript
TypeScript starts from the syntax and semantics that millions of JavaScript developers know today.
With TypeScript, you can use existing JavaScript code, incorporate popular JavaScript libraries, and be called from other JavaScript code.
TypeScript compiles to clean, simple JavaScript code which runs on any browser, in Node.js, or
in any other ES3-compatible environment.
class Point {
x: number;
y: number;
constructor(x: number, y: number) {
this.x = x;
this.y = y;
}
getDist() {
return Math.sqrt(this.x * this.x +
this.y * this.y);
}
}
var p = new Point(3,4);
var dist = p.getDst();
alert("Hypotenuse is: " + dist);