I want to use some property decorator (@Type from 'class-transformer' package) on a parameter, that is a property shorthand. Basically convert this:
class Test {
@Type(() => SomeClassType)
public prop1: SomeClassType;
constructor(prop1: SomeClassType) {
this.prop1 = prop1;
}
}
Into this:
class Test {
constructor(@Type(() => SomeClassType) public prop1: SomeClassType) {}
}
The problem is that decorator Type is only Property decorator, not a Property AND/OR Parameter decorator. So that I cannot use it directly on a parameter.
What is the easiest way to create a wrapper/adapter on a property decorator to make it work with parameter
(note: a parameter here is a shorthand property - public prop1: ...)