Skip to content

Instantly share code, notes, and snippets.

/gist:3818003
Created Oct 2, 2012

Embed
What would you like to do?
TypeScript implements keyword
interface IGreeter {
greeting: string;
greet() : string;
}
class Greeter implements IGreeter{
greeting: string;
constructor (message: string) {
this.greeting = message;
}
greet() {
return "Hello, " + this.greeting;
}
}
var greeter = new Greeter("world");
var button = document.createElement('button')
button.innerText = "Say Hello"
button.onclick = function() {
alert(greeter.greet())
}
document.body.appendChild(button)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.