title: Strict type checking for property type with property decorator
body: <p>Is there a way to validate the type of the property that is decorated in Typescript? I would like a property decorator that only works on <code>boolean</code> class properties, but not on e.g. <code>string</code> (example below). Is this possible?</p>
  
  <p><em>(Note: I don't want runtime validation via reflect-metadata, just a compile type warning with Typescript.)</em></p>
  
  <pre><code>function booleanProperty&lt;T extends HTMLElement&gt;(target: T, prop: string) {
    // `target` will be the class' prototype
    Reflect.defineProperty(target, prop, {
      get(this: T): boolean {
        return this.hasAttribute(prop);
      },
      set(this: T, value: boolean): void {
        if (value) {
          this.setAttribute(prop, '');
        } else {
          this.removeAttribute(prop);
        }
      }
    });
  }
  
  class MyElement extends HTMLElement {
    @booleanProperty
    foo: boolean;
  
    @booleanProperty
    bar: string; // TS compile error
  }
  customElements.define('my-element', MyElement);
  </code></pre>