Created
December 29, 2021 07:53
-
-
Save voldikss/60c386a8517ba790a6177c2a8b9b6518 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@classDecFactory() | |
class Student { | |
@propertyDecFactory() | |
name: string | |
@methodDecFactory() | |
run(@parameterDecFactory() arg: string) { | |
console.log(arg) | |
} | |
} | |
function classDecFactory(): ClassDecorator { | |
return (target) => { | |
console.log('classDecFactory', target, typeof target) | |
} | |
} | |
function propertyDecFactory(): PropertyDecorator { | |
return (target, propertyKey) => { | |
console.log('propertyDecFactory', target, typeof target) | |
} | |
} | |
function methodDecFactory(): MethodDecorator { | |
return (target, propertyKey, descriptor) => { | |
console.log('methodDecFactory', target, typeof target) | |
} | |
} | |
function parameterDecFactory(): ParameterDecorator { | |
return (target, propertyKey, parameterIndex) => { | |
console.log('parameterDecFactory', target, typeof target) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment