I have a basic decorator function in Python that I am using to decorate another function.
def decorator(fn):
def wrapper(args):
print("calling function")
fn(args)
return wrapper
@decorator
def printMyName(name):
print(name)
printMyName('pengooX')
When attempting to create something similar in TypeScript, an error is generated. Below is the code:
function decorator(fn){
function wrapper(args){
console.log("calling function")
fn(args)
}
return wrapper
}
@decorator
function printMyName(n){
console.log(n)
}
printMyName('pengooX')
I am curious if raw function decorators are supported in TypeScript and, if not, what potential issues could arise from this. Upon checking the TypeScript documentation, I found no mention of raw function decorators: documentation.