Microsoft Samurai

Introduction to Typescript

 

By @ErikRalston

Overview

  • Challenges with JavaScript

  • Typescript Syntax

  • Writing code in an editor

Audience

JavaScript developers looking to solve some frustrations

Why
Typescript?

Proof
By
Contradiction

Keep Using Proven Technology With Decades of Experience

Use Object-Oriented Programming When Needed

 

The Language Supports It!

Object
Oriented
ANSI-C

struct Class {
    size_t size;
    void * (* ctor) (void * self, va_list * app);
    void * (* dtor) (void * self);
    void * (* clone) (const void * self);
    int (* differ) (const void * self, const void * b);
};

struct String {
    const void * class; /* must be first */
    char * text;
};

No programming technique

solves all problems.

 

No programming language

produces only correct results.

- Axel-Tobias Schreiner, 1993

var ExampleClass = (function () {
    function ExampleClass() {
    }
    ExampleClass.prototype.exampleFunction = function () {
        // This is hard to read
        this.exampleClassVariable = "Hello World";
    };
    return ExampleClass;
})();

var ex = new ExampleClass();

About Typescript

Made by Anders Heljsberg, the Creator of C#

Compiles into ECMAScript 6, 5, or 3

Supports back to IE7

Typescript is Made From Typescript

Syntax
Overview

Simple
Example

Require JS
Example

Thank
You

Microsoft Samurai: Introduction to Typescript

By Erik Ralston

Microsoft Samurai: Introduction to Typescript

An introduction to Typescript, a typed superset of JavaScript for object-oriented client-side web apps

  • 778