Question: I have an instrument and I can `telnet` it to using `telent 192.168.100.2 2000` from `cmd` window. This will open up a terminal and I can give commands to the instrument. For example, a command like `"/tgc/rf/tx1 set gain_target -2.0"`. This works fine. Is there a way I can give these together in a single step; something like this :

```
telent 192.168.100.2 2000 /tgc/rf/tx1 set gain_target -2.0.

```

Thanks.

Answer: 
TypeScript emits additional metadata with [`emitDecoratorMetadata` compiler option](https://www.typescriptlang.org/docs/handbook/decorators.html#metadata) which is available with `reflect-metadata` polyfill for [metadata proposal](https://rbuckton.github.io/reflect-metadata/).

As the proposal states, there can be design-time metadata emitted for property type, method parameter and method return value types.

Visibility is not among emitted metadata, so it's unavailable for decorated members at runtime.

Since both visibility and decorators are specified by a developer, there wouldn't be much benefit from `@isThisPublic()` decorator, because a developer can specify respective decorators (whatever they are for):

```
class Test {
  @Public test1?: any;
  @Private private test2?: any;
}

```
As estus mentions in his answer there is no support for this in the compiler. 

Adding a decorator specifying the public/private nature of the field is a good option, but there is always potential in a team that a developer might not be aware of the need for the decoration and forget to add it, or even that the decorator and the modifier might diverge (yes they are right next to each other but sometimes people ignore the obvious), which may lead to bugs down the line.

One way we could add this information ourselves in a type safe way, is to use the fact that `keyof` returns only public fields of the a class. Using this we can build a function that takes an object with only the public fields of the class. The compiler will then enforce that the argument to this function must contain all public fields and only the public fields, and any other field will raise an error.

```
function isPublicMetadata<T>(publicFields: Record<keyof T, true>){
    return publicFields;
}

const publicTestFields = isPublicMetadata<Test>({
    test1: true
    // test2 : true // this is an error
})

class Test {
    test1?: any;
    private test2?: any;
}

```