Avi
Avi

Reputation: 1

Visual Studio 2015 TypeScript

I have Visual Studio 2015 and I'm trying to use typescript. I copied the example from typescript playground at: http://www.typescriptlang.org/Playground

and I'm seeing the following warning: Expected '('.

this is the code:

<script>
    class Greeter {
        greeting: string;
        constructor(message: string) {
            this.greeting = message;
        }
        greet() {
            return "Hello, " + this.greeting;
        }
    }

    var greeter = new Greeter("world");

    var button = document.createElement('button');
    button.textContent = "Say Hello";
    button.onclick = function() {
        alert(greeter.greet());
    }

    document.body.appendChild(button);
</script>

please help

Upvotes: 0

Views: 143

Answers (1)

Louay Alakkad
Louay Alakkad

Reputation: 7408

You can't put TS directly in HTML.

Upvotes: 3

Related Questions