vendredi 16 novembre 2018

TypeScript: how to use Reflect.metadata on inner property?

Here is what I want to do:

class MyClass {
  @Reflect.metadata("desc", "My outer property") // OK
  outerProp: {
    @Reflect.metadata("desc", "My inner property") // Error
    innerProp: string;
  };
}

The error is "[ts] Property or signature expected."

Why does the decorator work for outerProp but not for innerProp? Is there any way to do this without refactoring outerProp's type into a named class?





Aucun commentaire:

Enregistrer un commentaire