Can the custom param decorator in nestjs be used outside of a controller? I am attempting to apply it on a function parameter within a class, but when I call that function, it gives an error saying it expects 1 argument, indicating that the decorator is not applied,
Here is a snippet of the code
import { createParamDecorator } from '@nestjs/common'
// Custom parameter decorator
const MyParamDecorator = createParamDecorator((data, req) => {
return 'DefaultParameterValue'
})
class MyClass {
myFunction(@MyParamDecorator() param?: string) {
console.log('Parameter value:', param)
}
}
const instance = new MyClass()
instance.myFunction()