ECMAScript 6, the next version of JavaScript, adds class-based object-orientation to JavaScript and, since TypeScript includes all the features available in ES6, developers are allowed to use class-based object orientation today, and compile them down to JavaScript that works across all major browsers and platforms, without having to wait for the next version of JavaScript.
Let's take a look at a simple TypeScript class definition example:
class Character { public fullname: string; public constructor(firstname: string, lastname: string) { this.fullname = `${firstname} ${lastname}`; } public greet(name?: string) { if (name) { return `Hi! ${name}! my name is ${this.fullname}`; } else { return `Hi! my name is ${this.fullname}`; } } } ...