Skip to content

Instantly share code, notes, and snippets.

@ide-an
Created October 28, 2012 07:33
Show Gist options
  • Save ide-an/3967971 to your computer and use it in GitHub Desktop.
Save ide-an/3967971 to your computer and use it in GitHub Desktop.
TypeScript Class: TypeScript types by structure(, not inheritance?)
class Hoge{
constructor(public x:number,public y:number){}
}
class Fuga{
constructor(x:number,y:number){}
x:number;
y:number;
}
function f(v:Fuga){
console.log(v.x+":"+v.y);
}
var h = new Hoge(10,29);
f(h);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment