Skip to content

Instantly share code, notes, and snippets.

@dupski
Last active January 25, 2017 09:44
Show Gist options
  • Save dupski/1bfa64e0580bab24c83365b75268e20f to your computer and use it in GitHub Desktop.
Save dupski/1bfa64e0580bab24c83365b75268e20f to your computer and use it in GitHub Desktop.
Typescript Property Decorator factory test
function format(name: string)
{
return function(target: Object, propertyKey: string | symbol) {
console.log('name:', name, 'factory args', arguments);
};
}
class Greeter {
@format('test')
greeting: string;
constructor(message: string) {
this.greeting = message;
}
greet() {
}
}
const greet = new Greeter('test');
greet.greet();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment