TypeScript Version: 2.3.2
Code
//Here is my code:
.
.
.
constructor(
@InputType({
name : 'Id',
type : 'text',
readOnly : true,
disabled : true,
width : '300px',
order : 1,
tableColumn : 0,
sortable : true
})
public id? : number) {
}
.
.
.
//Here is my decorator
.
.
.
export function InputType(parameters : any) {
function actualDecorator(target: any, property: string | symbol, parameterIndex?: number): void {
console.log(property);
.
.
.
I was hoping to get the property name, but the property is undefined.
That is the intended design. There is no paramter discriptor created by the compiler. this is waiting on the finalization of the property declaration ES proposal that will define how initializes will be defined (no definition for it now in the descriptors).
Sorry, but I was not convinced of that, because this is in the documentation even if it is an experimental feature of TypeScript:
https://www.typescriptlang.org/docs/handbook/decorators.html
Most helpful comment
Sorry, but I was not convinced of that, because this is in the documentation even if it is an experimental feature of TypeScript:
https://www.typescriptlang.org/docs/handbook/decorators.html