rbuckton / reflect-metadata

Prototype for a Metadata Reflection API for ECMAScript

Home Page:https://rbuckton.github.io/reflect-metadata

Repository from Github https://github.comrbuckton/reflect-metadataRepository from Github https://github.comrbuckton/reflect-metadata

It it possible to get method visibiility

tonyxiao opened this issue · comments

While building a class decorator, it's can be useful to know which methods are private and which ones are not. In particular I'm building a logging decorator and want to log all the public methods.

While it is possible to record this information, if provided, reflect-metadata does not have any insight or control over what TypeScript emits. You would be able to create a decorator that indicates privacy, but you would likely have to duplicate the privacy on the member, e.g.:

class C {
  @privacy("private") private m() {}
} 

You can always file a suggestion on the https://github.com/Microsoft/TypeScript repo for this as well.

Got it, this is useful. Thank you!