简体   繁体   中英

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

您不能直接在HTML中放入TS。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM