The Large-Scale Web App Scaling Wall
Building Single Page Applications (SPAs) requires writing thousands of lines of client-side JavaScript. JavaScript's dynamic typing makes maintaining massive codebases difficult—simple typos in property names result in runtime crashes.
Microsoft has announced TypeScript, a typed superset of JavaScript compiled by Anders Hejlsberg (creator of C#).
Key Concepts of TypeScript
TypeScript adds optional static types, class layouts, and modular interfaces to standard JavaScript:
// Early class syntax in TypeScript 0.8
interface User {
username: string;
email: string;
}
class DashboardController {
private activeUser: User;
constructor(user: User) {
this.activeUser = user;
}
public render(): void {
console.log("Rendering dashboard for " + this.activeUser.username);
}
}Compile-to-JavaScript Output
The TypeScript compiler (tsc) type-checks code and compiles it down to standard ECMAScript 3/5 JavaScript compatible with any browser, bringing compile-time safety and IDE autocomplete to web applications.