summaryrefslogtreecommitdiff
path: root/tests/examplefiles/typescript_example
blob: 760e25434f3a188f13709f63cea7f0a7628f9dde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
class Animal {
    constructor(public name) { }
    move(meters) {
        alert(this.name + " moved " + meters + "m.");
    }
}

class Snake extends Animal {
    constructor(name) { super(name); }
    move() {
        alert("Slithering...");
        super.move(5);
    }
}

class Horse extends Animal {
    constructor(name) { super(name); }
    move() {
        alert("Galloping...");
        super.move(45);
    }
}

@View({
    templateUrl: "app/components/LoginForm.html",
    directives: [FORM_DIRECTIVES, NgIf]
})
@Component({
    selector: "login-form"
})
class LoginForm {

}

var sam = new Snake("Sammy the Python")
var tom: Animal = new Horse("Tommy the Palomino")

sam.move()
tom.move(34)