Skip to content

Instantly share code, notes, and snippets.

@tmlbl
Created April 21, 2015 23:00
Show Gist options
  • Save tmlbl/cf6b5a342041dba51db9 to your computer and use it in GitHub Desktop.
Save tmlbl/cf6b5a342041dba51db9 to your computer and use it in GitHub Desktop.
Typed Class
class Typed<T> {
type: T
constructor(obj: T) {
this.type = obj;
}
}
interface MyType {
prop: string;
}
var instance = new Typed<MyType>({ prop: 'foo' });
console.log(instance.type.prop); // foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment