title: Angular 9 decorate for required value of a property
body: <p>I was wondering whether it is possible to create a decorator for a property which checks if  value is assigned to it or not yet.</p>
  <p>I want to create a required Decorator on a property.
  Suppose I have a directive and some properties need to have a value which is given when the directive is used/called.</p>
  <pre><code>@Directive({...})
  export class xyz
    @Input()
    @Required()
    get name() {...}
    set name(s: string) {...}
  }
  </code></pre>
  <p>Somewhere other part of app.</p>
  <pre><code>&lt;div xyz&gt;....&lt;/div&gt;
  </code></pre>
  <p>This should throw an error because name property is missing, and it is kind of required in directive class.</p>
  <pre><code>&lt;div xyz [name]=&quot;'anyName'&quot;&gt;....&lt;/div&gt;
  </code></pre>
  <p>I have tried couple but can't...</p>
  <pre><code>export function Required() {
    return (target: {} | any, name: PropertyKey): any =&gt; {
      const descriptor = {
        get(this: any) {
          console.log(this);
          const propertyName = `__${String(name)}`;
          if (!this[propertyName]) {
            this[propertyName] = createId();
          }
          return this[propertyName];
        },
        enumerable: true,
        configurable: true,
      };
      Object.defineProperty(target, name, descriptor);
    };
  </code></pre>
  <p>But I can't acheive the goal.</p>
  <p>I don't know how can I require a property via decorator. I know there is an other way using selector but I was wondering if this can be done by a decorator.</p>
  <p>Thanks</p>
  <p>Edit:
  At runtime is it possible to use the decorator?</p>